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.
Use the DATEADD function with a -30 for number of days to add. Don't have my functions book at the moment so I'm not sure of all the parms.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
To add an explanation that might be helpful, variables do NOT have an associated "format" so using DATECVT on the variable &MDYY gives you nothing more than your original &MDYY. Also the resultant value is not a "date" but a number - i.e. 5072008 instead of 05072008. You cannot act on it as you could a database field because there is no concept of a "date" format in a variable. So taking 30 "days" away is just performing a calculation of 5072008 - 30 giving you a numeric result of 5071978 and not a "date".
To get what you want, you will have to do as Darin and Danny suggest and action your date difference on the actual date variable, but remember, that will also give you a number and not a "date" albeit a numeric representation of a date. Also note that Danny used I8YYMD format in AYMD, that is because you cannot use MDYY formats in the AYMD function. If you use MDYY format in DATEADD (-SET &D30 = DATEADD(&MDYY, 'D', -30); ), then you will end up with exactly the same result as using your original method - i.e. 5071978 - a number that looks like a date but the wrong one. For me DATEADD is not the function to use with variables.
So, armed with the knowledge that "date" variables are actually a number and not a date, you therefore understand that 5072008 could be interpretted by the end user as 5th July 2008 or 7th May 2008 but internally it will always be 5 million, 72 thousand and 8!
Your way forward? I would use the AYMD format and adjust your code accordingly within any validation or predicate and remember that you are using a numeric representation of a date and not a real date. I would also recommend always using YYMD farmats for "date" variables.
TThis message has been edited. Last edited by: Tony A,
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, 2004
Actually, this has been covered in several other threads. To use the new date functions (DATEADD, DATEDIF, DATEMOV, etc.) with Dialogue Manager, you have to convert the &variable, ie. &YYMD, to a smart date, apply the desired function, then convert it back to an &variable format. In my case, I have a job that I need to run on the 3rd business day of the month and it has to respect our holiday file. Consider the following where I compute &RUNDT to be the 3rd business of the month.
The innermost DATECVT take &YYMD and converts it to a smart date. DATEMOV then "moves" the result to the 1st day of the month. DATEADD then adds 2 business days to the 1st of the month. The outermost DATECVT converts the smart date back to an I8YYMD format that DM can understand.
I can't take credit for this, someone first posted it, but it has been a life saver.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006
So once you get the item into a smart date - which is number of days - you can do DAY kind of math ... - 30 days ... or even average 3 days. But since you do not think in number of days, use DATECVT to get it back to a YYMD domain. -* add 30 days ... -SET &RUNDT=DATECVT((DATECVT(&YYMD,'I8YYMD','YYMD')+30),'YYMD','I8YYMD');
Brian Suter VP WebFOCUS Product Development
Posts: 200 | Location: NYC | Registered: January 02, 2007
which gives u 30 days back date with format ex: 20080408 If u want the Date in different format create virtuval field with formats available in WebFOCUS.
Ex: 30DBACK/YYMD = &30DAYSAGO; which gives you date in format 2008/04/08.
Thanks, Saikumar.
WebFOCUS 8103 Appstudio, Dev Studio MRE Client Windows 7, Serveron Unix. Excel, PDF, HTML,AHTML