Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Result of DATEADD in -SET
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Result of DATEADD in -SET
 Login/Join
 
Member
posted
We want to use a simple loop to create datasets based on date parameters. When using DATEADD in a -SET statement, the result appears to be a serial date value. Any suggestions on how to return the value formatted 'like' YYMD in our initial -SET statements?

 
-SET &START = 20180701;
-SET &END = 20190630;
-SET &START_FY = '2018/07/01';
-SET &END_FY = '2019/06/30';

-TYPE &START
-TYPE &END
-TYPE &START_FY
-TYPE &END_FY

-REPEAT LOOP FOR &I FROM 0 TO 1;

	-SET &START = &START + 10000;
	-SET &END = &END + 10000;
	-SET &START_FY = DATEADD(&START_FY,'Y',1);
	-SET &END_FY = DATEADD(&END_FY,'Y',1);

	-TYPE &START
	-TYPE &END
	-TYPE &START_FY
	-TYPE &END_FY

-LOOP

This message has been edited. Last edited by: jltz83od,


WebFOCUS 8.2.06, Windows
 
Posts: 19 | Registered: July 18, 2019Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Try using the DATECVT function … Run this loop and see if that helps you out.

-SET &CURR_YYMD = &YYMD;
-REPEAT LOOP FOR &I FROM 0 TO 9;
-SET &LOOP_YYMD = DATECVT((DATEADD((DATECVT (&CURR_YYMD, 'I8YYMD', 'YYMD')),'Y', &I)), 'YYMD','I8YYMD');
-SET &LOOP_FY   = EDIT(DATECVT(&LOOP_YYMD,'I8YYMD','A8YYMD'),'9999/99/99');
-TYPE CURR_YYMD = &CURR_YYMD ~ I = &I ~ LOOP_YYMD = &LOOP_YYMD ~ LOOP_FY = &LOOP_FY
-LOOP
 


WebFocus 8.201M, Windows, App Studio
 
Posts: 226 | Location: Lincoln Nebraska | Registered: August 12, 2008Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Another solution could be :

-SET &START_FY = '2018/07/01';
-SET &END_FY   = '2019/06/30';

-REPEAT LOOP FOR &I FROM 1 TO 3
-SET &START_FY = DATETRAN(DTADD('&START_FY.EVAL', YEAR, 1), '(YYMD)', '(/)', 'EN', 10, 'A10');
-SET &END_FY   = DATETRAN(DTADD('&END_FY.EVAL',   YEAR, 1), '(YYMD)', '(/)', 'EN', 10, 'A10');
-TYPE &START_FY
-TYPE &END_FY
-LOOP


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2368 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
Both great solutions. Thank you!


WebFOCUS 8.2.06, Windows
 
Posts: 19 | Registered: July 18, 2019Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Result of DATEADD in -SET

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.