Focal Point
[CLOSED] Previous Month

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

April 18, 2013, 08:29 AM
windows
[CLOSED] Previous Month
I have a filter which has to display default the previous month in the calender button.
any speicifc code

This message has been edited. Last edited by: <Kathryn Henning>,


Webfocus7703/Windows7/PDF.HTML
April 22, 2013, 09:27 AM
windows
any help...


Webfocus7703/Windows7/PDF.HTML
May 02, 2013, 08:42 PM
<Kathryn Henning>
Hi windows,

Could you please provide us with some additional information about what you're trying to accomplish? Are you using the HTML Composer or coding this in an editor? What is the code in your filter?

Thanks and regards,

Kathryn
May 02, 2013, 09:25 PM
Dan Satchell
Maybe something like this:

-SET &CUR_YYM   = EDIT(&YYMD,'999999$$');
-SET &PRV_YYM   = AYM(&CUR_YYM,-1,'I6YYM');
-SET &RPT_MTHYY = LCWORD(14,CHGDAT('A6YYM','MXYY',&PRV_YYM,'A14'),'A14');
-SET &RPT_MONTH = GETTOK(&RPT_MTHYY,&RPT_MTHYY.LENGTH,1,' ',9,'A9') || ',' ||
-                 (' ' | GETTOK(&RPT_MTHYY,&RPT_MTHYY.LENGTH,2,' ',4,'A4'));
-TYPE &RPT_MONTH



WebFOCUS 7.7.05
May 03, 2013, 06:18 AM
Alan B
If this is HTML Composer you could try this. Create a fex to populate calendar:
-* File lastmonth.fex
SET HOLDLIST=PRINTONLY
DEFINE FILE SYSCOLUM
INPUT/YYMD=&YYMD;
OUTPUT/YYMD=DATEADD(INPUT, 'M', -1);
END
TABLE FILE SYSCOLUM
PRINT OUTPUT
BY OUTPUT
BY TBNAME NOPRINT
IF READLIMIT EQ 1
ON TABLE PCHOLD FORMAT XML
END

and then add a calendar control.
Use external procedure to link the calendar. Set value and display field as OUTPUT and format as YYMD.


Alan.
WF 7.705/8.007
May 07, 2013, 03:23 PM
Doug
You could create a variable in DM, sample code below, and use it as the default within the calendar control as "!IBI.AMP.OneMonthAgo;"
-SET &OneMonthAgo = DATECVT(&YYMD,'I8YYMD','YYMD');
-SET &OneMonthAgo = DATEADD(&OneMonthAgo, 'M', -1);
-SET &OneMonthAgo = DATECVT(&OneMonthAgo,'YYMD','A8YYMD');
-TYPE *** Today is &YYMD, one month ago was &OneMonthAgo ***
OK, so I like to reuse variable. This was some code from back in 2007. and it worked then as well as today...

So, why not, There's "(Almost) 1001 Ways To Work With DATES in WebFOCUS"?

BTW: Try this with TESTDATE for different date verifications.
Samples:
*** Today is 20130507, one month ago was 20130407 ***
*** Today is 20130331, one month ago was 20130228 ***