Focal Point
[Solved] Full Date Conversion

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

May 22, 2018, 11:09 AM
Tim P.
[Solved] Full Date Conversion
Is there a way to take a date like:

May 25, 2018

and convert it to YYMD or MDYY in WF8105 dialogue manager? I feel like there should be an easy way to do this but for the life of me i can't seem to get the function right.

Thanks for the help!

This message has been edited. Last edited by: Tim P.,


WebFOCUS App Studio 8.2.02
Windows 7, All Outputs
May 22, 2018, 11:16 AM
BabakNYC
You'll have to decompose all the components using character functions first, and then assemble them into the YYMD. This would involve DECODE of the Month into the 2 digit month number. I'd start with SUBSTR and go from there.

How bad do you need this? It's a lot of code.


WebFOCUS 8206, Unix, Windows
May 22, 2018, 11:23 AM
Tim P.
yea decomposing the date and the concantenating it back together was about the only way i got close to what i needed.

It's not critical right now as i'm just fiddling around in the new 8203 portal page designer. If your content is driven by a date parameter, the control is predicated on that parameter but the default format in the control is as above and i don't see a way to change it.


WebFOCUS App Studio 8.2.02
Windows 7, All Outputs
May 22, 2018, 04:51 PM
Edward Wolfgram
FOCUS has supported something called "natural dates" (constants) from forever, but to my knowledge this is not exposed in a user function. The code below will work on most platforms:

-DEFAULTS &INDATE = 'Jan 1, 2018' ;
FI MYFEX DISK myfex.fex (LRECL 80
DEFINE FILE CAR
MYDT/YYMD WITH COUNTRY = '&INDATE' ;
MYA/A8YYMD = MYDT ;
ACMD/A80 = '-SET ' | '&&' | 'WOW=' | '''' | MYA | '''' | ';' ;
END
TABLE FILE CAR
PRINT ACMD
IF RECORDLIMIT EQ 1
ON TABLE SAVE AS MYFEX
END
-RUN
EX MYFEX
-RUN
-TYPE DATE IS &&WOW
-EXIT


Once you have the global variable &&WOW, you can use any of the date functions from dialog mgr to get any date you want.


IBI Development
May 23, 2018, 07:28 AM
Tim P.
Yea it looks like using the car file (or any other small temp table) may be the only way. I was kind of hoping for a solution that didn't involve bringing in a table but oh well.
Thanks for the help!


WebFOCUS App Studio 8.2.02
Windows 7, All Outputs
May 23, 2018, 08:56 AM
dbeagan
This could be a way to go:
 

-DEFAULT &Date1 = 'May 25, 2018';

 DEFINE FUNCTION TODATE(null/I1)
 DTEMDYY/MDYY = '&Date1';
 TODATE/A8MDYY = DTEMDYY;
 END
-RUN

-SET &Date2 = TODATE(.);
-TYPE &Date1 --> &Date2  



WF 8.2.06
Win10 / IE11
AHTML EXL2K PDF