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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at email@example.com and provide your corporate email address, company, and name.
Do not use DATEADD with Dialogue Manager. DATEADD requires a date to be in date format; Dialogue Manager interprets a date as alphanumeric or numeric.
To use DATEADD in Dialogue Manager, you will need to use the DATECVT function to convert your DM date to a valid SmartDate value, then perform your DATEADD, and then convert the result back to a DM value.
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
I forget who initially suggested this, may have been Francis, but this works great. Create DEFINE FUNCTIONs for DATEADD, DATEDIF and DATEMOV for use with Dialogue Manager. Just include the following in the edasprof and it is always available:
-* Use this function to use DATEADD in Dialogue Manager
DEFINE FUNCTION UDATEADD(INDATE/A8YYMD, INUNIT/A2, INNBR/I4)
INDATE1/YYMD = INDATE;
UDATEADD1/YYMD = DATEADD(INDATE1, INUNIT, INNBR);
UDATEADD/A8YYMD = UDATEADD1;
-* Use this function to use DATEDIF in Dialogue Manager
DEFINE FUNCTION UDATEDIF(FROM_DATE/A8YYMD, TO_DATE/A8YYMD, DIF_UNIT/A2)
FRDT/YYMD = FROM_DATE;
TODT/YYMD = TO_DATE;
UDATEDIF1/YYMD = DATEDIF(FRDT, INDT, DIF_UNIT);
UDATEDIF/A8YYMD = UDATEDIF1;
-* Use this function to use DATEMOV in Dialogue Manager
DEFINE FUNCTION UDATEMOV(INDATE/A8YYMD, INMVTO/A3)
INDATE1/YYMD = INDATE;
UDATEMOV1/YYMD = DATEMOV(INDATE1, INMVTO);
UDATEMOV/A8YYMD = UDATEMOV1;
Now you can do this:
SET BUSDAYS = _MTWTF_
-TYPE &YYMD &PREVDAY &LASTDAY &BDAYSDIF
This message has been edited. Last edited by: jgelona,
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006