[SOLVED] Adding number of days to a virtual date field
My task is to calculate an expiration date and populate on a report as a field. The expiration date is a calculation that adds the shelf-life number of days (field in a table xld_1) to another date (virtual field exdt_2) to arrive at a date where the material is expected to expire. I believe I need to create a define by adding the shelf life days (DATEADD??) to the other date but not sure how to achieve this and any help or example would be greatly appreciated.
Solution Solved: ExpDate/YYMD= DATEADD(ExpYYMD, 'D', IR_SLD_I);This message has been edited. Last edited by: Kort Thompson,
KW
WF Versions: DEV 8105 OS: Windows Outputs: HTML, Excel In WebFOCUS since March '19
Also, please update you signature to add your WF version. That may help to point you to the proper solution according to your version
And why [Advise??] in your subject ? Try to stay with forum's structure : Forum Guidelines
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 15, 2019, 09:32 AM
Kort Thompson
Thank you Martin for the guidance.
KW
WF Versions: DEV 8105 OS: Windows Outputs: HTML, Excel In WebFOCUS since March '19
August 15, 2019, 11:03 AM
MartinY
Hi Kort,
Here a simple sample where I extract a NBDAYS value to increment from based on another file
TABLE FILE CAR
BY SEATS AS 'NBDAYS'
WHERE COUNTRY EQ 'JAPAN';
ON TABLE HOLD AS INCRDAYS
END
-RUN
-READFILE INCRDAYS
-DEFAULTH &NBDAYS = 0
-TYPE NBDAYS: &NBDAYS
DEFINE FILE WF_RETAIL
NEWDATE/YYMD = DTADD(DATE_OF_BIRTH, DAY, &NBDAYS);
END
TABLE FILE WF_RETAIL
SUM DATE_OF_BIRTH
NEWDATE
BY ID_MANAGER
ON TABLE SET PAGE NOPAGE
END
-RUN
Look at manager id 901 where the DTADD function manage the fact the +4 days has also changed the month
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 15, 2019, 02:20 PM
Kort Thompson
Thanks for the help Martin! Really appreciate you
KW
WF Versions: DEV 8105 OS: Windows Outputs: HTML, Excel In WebFOCUS since March '19
August 15, 2019, 02:30 PM
MartinY
My pleasure
If solved, please edit your first post then add [SOLVED] at the beginning of the subject instead of [SHARING] which is not the case for that post. You were not sharing with us a solution that you found, but was asking for a solution.
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