Focal Point
[CLOSED] User inputted date plus 5 'WD' and to fetch respective date records

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4867030496

July 30, 2020, 06:00 AM
WF Learner
[CLOSED] User inputted date plus 5 'WD' and to fetch respective date records
Hello,
I have a requirement where user would be selecting a date input and based on the date selected i have to add 5 working days to it and to show rows having one of the 5 dates computed in the output based on a date time column .
For ex: User is selecting 30th July as date input to run the report and there is a column A which is a date time field. Expected output should be 30th, 31st and 3rd, 4th and 5th Aug date rows matching on the column A.
I am actually looking for a sample data set to replicate this scenario and will post. Meanwhile any inputs appreciated. Thank you.

This message has been edited. Last edited by: FP Mod Chuck,
July 30, 2020, 08:01 AM
MartinY
Don't know all your spec, but here is a start

-DEFAULTH &I = 1
-DEFAULTH &INDT = 20200730
DEFINE FILE GGSALES
-* Below line is only used to convert &INDT field into a YYMD format and be able to use DATEADD function
DT     /YYMD = DATECVT(&INDT, 'I8YYMD', 'YYMD');
-REPEAT LOOPDT FOR &I FROM 1 TO 5
NDATE&I.EVAL /YYMD = DATEADD(DT, 'WD', &I);
-LOOPDT
END
TABLE FILE GGSALES
BY DATE NOPRINT
BY DT
BY NDATE1
BY NDATE2
BY NDATE3
BY NDATE4
BY NDATE5
WHERE RECORDLIMIT EQ 1;
END
-RUN



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
August 03, 2020, 06:54 AM
WF Learner
Thank you MartinY.
But my date input is selected in a calendar and it takes the following format which is July 01, 2020. How to change this to M/D/YYYY format.
August 03, 2020, 07:26 AM
MartinY
The M/D/YYYY is a display format and not really an "input" format

-DEFAULTH &I = 1
-DEFAULTH &INDT = 20200730
DEFINE FILE GGSALES
-* Below line is only used to convert &INDT field into a YYMD format and be able to use DATEADD function
DT     /YYMD = DATECVT(&INDT, 'I8YYMD', 'YYMD');
-REPEAT LOOPDT FOR &I FROM 1 TO 5
NDATE&I.EVAL /YYMD = DATEADD(DT, 'WD', &I);
ODATE&I.EVAL /I8MDYY = NDATE&I.EVAL;
-LOOPDT
END
TABLE FILE GGSALES
BY DATE NOPRINT
BY DT
BY ODATE1
BY ODATE2
BY ODATE3
BY ODATE4
BY ODATE5
WHERE RECORDLIMIT EQ 1;
END
-RUN



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
August 03, 2020, 03:58 PM
WF Learner
Thank you MartinY. In your code you have hard coded date and i replicated by passing a dynamic calendar date selected by user and i am not able to get right formatting. Can you please help? The code that i tried i'll post shortly.