Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     DATEADD with strange results

Read-Only Read-Only Topic
Go
Search
Notify
Tools
DATEADD with strange results
 Login/Join
 
<Ryan>
posted
Hello All!

This is another DATEADD question that I can't seem to find an answer for. I guess it is more of a strange result.

All my dates are in YYMD format.

So here is my code snipet:

-SET &TODAY = &YYMD;
-SET &LASTMONTH = DATECVT((DATEADD((DATECVT(&TODAY,'I8YYMD','YYMD')),M,-1)),'YYMD','I8YYMD');
-*****
-SET &MINDATE = DATECVT((DATEMOV((DATECVT(&LASTMONTH,'I8YYMD','YYMD')),'BOM')),'YYMD','I8YYMD');
-SET &MAXDATE = DATECVT((DATEADD((DATECVT(&TODAY,'I8YYMD','YYMD')),D,-1)),'YYMD','I8YYMD');
-*****
-TYPE &YYMD &TODAY &LASTMONTH &MINDATE &MAXDATE
-EXIT


DISPLAY:
20071031 20071031 20070930 20070901 19001231

I know that when I get a date of 19001231 that it usually means an invalid date was passed. However I am passing the same value in another DATEADD function (&LASTMONTH) and it works correctly. The formula is almost identical to &LASTMONTH except for the day arithmatic instead of month.

Now, I also found out if I remove the &MINDATE line, &MAXDATE mysteriously starts displaying correctly.

I know this is Halloween and I should expect mysterious and strange things, but I could use some help figuring this one out.

Thanks,
Ryan
 
Report This Post
Master
posted Hide Post
DATEMOV and DATEADD are being called without a return argument.

I know that the manual says that it's only required for MAINTAIN, but all the other subroutines tend to drop the return argument for MAINTAIN.

You could try it with the return argument in case the manual is wrong.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
<Ryan>
posted
hammo1j, thanks for the fast response. I'll try it with a return arg and let you know how it goes.

I also found this out just now. If I change the &MINDATE formula, &MAXDATE displays correctly.

What I did was take the DATEADD part of the &LASTMONTH formula and put in the place of the &LASTMONTH parm in the &MINDATE formula (basically just combined a 2 step process into 1 step). Here is the code:

-SET &TODAY = &YYMD;
-*****
-SET &MINDATE = DATECVT((DATEMOV((DATEADD((DATECVT(&TODAY,'I8YYMD','YYMD')),M,-1)),'BOM')),'YYMD','I8YYMD');
-SET &MAXDATE = DATECVT((DATEADD((DATECVT(&TODAY,'I8YYMD','YYMD')),D,-1)),'YYMD','I8YYMD');
-*****
-TYPE &YYMD &TODAY &MINDATE &MAXDATE
-EXIT

DISPLAY:
20071031 20071031 20070901 20071030

Strange, huh?!?

I would like to have it separated back out, for the readability of the code, but if I can't at least this is working.

Thanks,
Ryan
 
Report This Post
<Ryan>
posted
Can't add a return arg. I get the following error:

(FOC275) FOCUS FUNCTION HAS INCORRECT NUMBER OF ARGUMENTS: )

Thanks,
Ryan
 
Report This Post
Virtuoso
posted Hide Post
quote:
the return argument



only works in a define, not in a set command.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
I just tried your originally posted code and got this:
20071031 20071031 20070930 20070901 20071030
which looks right. This looks like a WF version issue.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Ryan,

Stating the obvious, but if you want it "separated back out, for the readability of the code' then just rearrange the code.

I am on 7.6.2 also and get the same results as you, but having the following code works just fine - don't ask me why and just put it down to one of the oddities that we see occasionally from WebFOCUS Frowner

-SET &TODAY = &YYMD;
-SET &LASTMONTH = DATECVT((DATEADD((DATECVT(&TODAY,'I8YYMD','YYMD')),M,-1)),'YYMD','I8YYMD');
-*****
-SET &MAXDATE = DATECVT((DATEADD((DATECVT(&TODAY,'I8YYMD','YYMD')),D,-1)),'YYMD','I8YYMD');
-SET &MINDATE = DATECVT((DATEMOV((DATECVT(&LASTMONTH,'I8YYMD','YYMD')),'BOM')),'YYMD','I8YYMD');
-*****
-TYPE &YYMD &TODAY &LASTMONTH &MINDATE &MAXDATE

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
<Ryan>
posted
Very Interesting! I hadn't thought of simply moving the statements around. Thanks Tony!

And Thanks to everyone else as well
Ryan
 
Report This Post
Virtuoso
posted Hide Post
Ryan

on 7.1.4 your original works well...

interesting program WF...keeps you have work. Wink




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     DATEADD with strange results

Copyright © 1996-2020 Information Builders