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     [SOLVED]-SET using DATEADD

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]-SET using DATEADD
 Login/Join
 
Guru
posted
I need to calculate prior 2 months from the current date in YYYY/MM/DD format using a -SET command. Can someone send me an example? Thanks.

This message has been edited. Last edited by: Michele Brooks,


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
Here are some basic examples that I have in case I need them. You could tweak them to fit your specific needs.

-SET &&CURDATE=&YYMD;
 
-* This sets what Yesterday is:
-SET &&YESTERDAY=AYMD(&&CURDATE,-1,'I8YYMD');
 
-* This sets Current Year based upon Yesterday
-SET &&CYEAR=EDIT(&&YESTERDAY,'9999');
 
-* This sets Prior Year based upon Yesterday
-SET &&PYEAR=&&CYEAR-1;
 
-* This sets what the current month is based upon todays's date
-SET &&CMONTH=EDIT(&&CURDATE,'999999') || '01';
-SET &CMONTHYYM=EDIT(&&CURDATE,'999999');
 
-* This sets what last month is based upon today's date
-SET &&PMONTH=EDIT(AYM(&CMONTHYYM, -1, 'I6YMD')) || '01';
-SET &PMONTHYYM=EDIT(&&PMONTH,'999999');
 
-* This sets 7 days prior based upon &YESTERDAY
-SET &&P7DAY=AYMD(&&YESTERDAY,-7,'I8YYMD');
 
-* This sets prior 3 months based upon last month - it will generate complete data
-SET &&P3MONTH=EDIT(AYM(&PMONTHYYM, -1,'I6YYM')) || '01';
 
-* This sets prior 6 months based upon last month - it will generate complete data
-SET &&P6MONTH=EDIT(AYM(&PMONTHYYM, -4,'I6YYM')) || '01';
 
-* This sets prior 12 months based upon last month - it will generate complete data
-SET &&P12MONTH=EDIT(AYM(&PMONTHYYM, -12,'I6YYM')) || '01';



WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Expert
posted Hide Post
  
-SET &DATE_MINUS_2 = DATECVT(DATEADD(DATECVT(&YYMD,'I8YYMD','YYMD'),'M',-2), 'YYMD', 'I8YYMD');
-TYPE &DATE_MINUS_2
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Platinum Member
posted Hide Post
Very useful, thanks!

quote:
Originally posted by BabakNYC:
Here are some basic examples that I have in case I need them. You could tweak them to fit your specific needs.

-SET &&CURDATE=&YYMD;
 
-* This sets what Yesterday is:
-SET &&YESTERDAY=AYMD(&&CURDATE,-1,'I8YYMD');
 
-* This sets Current Year based upon Yesterday
-SET &&CYEAR=EDIT(&&YESTERDAY,'9999');
 
-* This sets Prior Year based upon Yesterday
-SET &&PYEAR=&&CYEAR-1;
 
-* This sets what the current month is based upon todays's date
-SET &&CMONTH=EDIT(&&CURDATE,'999999') || '01';
-SET &CMONTHYYM=EDIT(&&CURDATE,'999999');
 
-* This sets what last month is based upon today's date
-SET &&PMONTH=EDIT(AYM(&CMONTHYYM, -1, 'I6YMD')) || '01';
-SET &PMONTHYYM=EDIT(&&PMONTH,'999999');
 
-* This sets 7 days prior based upon &YESTERDAY
-SET &&P7DAY=AYMD(&&YESTERDAY,-7,'I8YYMD');
 
-* This sets prior 3 months based upon last month - it will generate complete data
-SET &&P3MONTH=EDIT(AYM(&PMONTHYYM, -1,'I6YYM')) || '01';
 
-* This sets prior 6 months based upon last month - it will generate complete data
-SET &&P6MONTH=EDIT(AYM(&PMONTHYYM, -4,'I6YYM')) || '01';
 
-* This sets prior 12 months based upon last month - it will generate complete data
-SET &&P12MONTH=EDIT(AYM(&PMONTHYYM, -12,'I6YYM')) || '01';



7.66 and 7.704
System: Windows / AIX / Linux
Output: Mostly HTML, with some PDF, Excel and Lotus(!)
 
Posts: 147 | Location: Toronto (GTA) | Registered: May 25, 2005Report This Post
Guru
posted Hide Post
Thank you both BabakNYC and Tom. Excellent dialogue manager date routines. I'll definitely keep them in my documentation file for future reference. I'm stuck on one more conversion. I need to do another -SET to get the end of the current month. My DATEMOV calculation is not coming out currently. Thanks again.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Expert
posted Hide Post
Same concept, DATEMOV function:
 
-SET &DATE_EOM = DATECVT(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),EOM), 'YYMD', 'I8YYMD');
-TYPE &DATE_EOM
-EXIT
 


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Platinum Member
posted Hide Post
Is it again time to suggest the document "1001 Way to Work With Dates" by Price and Perlmutter published by Aviter, Inc?


WebFOCUS 7.7.05 (Someday 8)
Windows 7, All Outputs
In Focus since 1983.
 
Posts: 103 | Registered: April 27, 2011Report This Post
Guru
posted Hide Post
Thanks so much Tom. I got it. This is good stuff. These examples are very helpful. You're the man. Thanks again.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report 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     [SOLVED]-SET using DATEADD

Copyright © 1996-2020 Information Builders