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] User inputted date plus 5 'WD' and to fetch respective date records
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] User inputted date plus 5 'WD' and to fetch respective date records
 Login/Join
 
Member
posted
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,
 
Posts: 21 | Registered: July 17, 2020Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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
 
Posts: 2368 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
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.
 
Posts: 21 | Registered: July 17, 2020Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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
 
Posts: 2368 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
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.
 
Posts: 21 | Registered: July 17, 2020Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] User inputted date plus 5 'WD' and to fetch respective date records

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