Focal Point
[CLOSED] x months ago

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

September 20, 2012, 05:46 AM
Peter
[CLOSED] x months ago
Okay, I'm half-way giving up here:

All I need to do is calculate the difference between a field FINMONTH in format I6YYM and today's date in the number of months.

I've just spent 1.5 hours trying every combination of DATECVT & DATEDIF I can come up with and I can't let it work!

This has to be possible in a single define?
(I can't believe something so simple is taking me so much time...)

This message has been edited. Last edited by: Peter,


Prod: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode
Test: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode
September 20, 2012, 06:14 AM
atturhari
TABLE FILE EMPLOYEE
PRINT FIRST_NAME
COMPUTE DT_FLD/I6YYM = 201106;
COMPUTE DT_FLD_MDYY/MDYY = DT_FLD;
COMPUTE TODAY/MDYY = '&MDYY';
COMPUTE DT_DIFF/I8 = DATEDIF(DT_FLD_MDYY, TODAY, 'M');
BY LAST_NAME
END

Enjoy!


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
September 20, 2012, 09:50 AM
Alan B
Or simpler:
TABLE FILE EMPLOYEE
PRINT FIRST_NAME 
COMPUTE DT_FLD/I6YYM = 201106;
COMPUTE MONTHS_HIRED/I3 = YM(DT_FLD,EDIT(EDIT(&YYMD,'9999999')), 'I3');
BY LAST_NAME
END




Alan.
WF 7.705/8.007
September 20, 2012, 12:53 PM
Dan Satchell
You can also use:
&DATEYY|&DATEM

instead of:
EDIT(EDIT(&YYMD,'999999$$'))



WebFOCUS 7.7.05
September 21, 2012, 05:09 AM
Peter
Thanks for the response all.

It seems my 'intuitive' thinking from previous years needs to be modified a bit to arrive at a more 'webfocus-oriented' thinking...


Prod: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode
Test: WebFOCUS 8.0.06 on Win2008/Tomcat7/LDAP Mode