There are times when you will want the user to be able to choose from a relative date vs. having to figure out the date or date range to select. For example, instead of picking the the first day of the current month , it would be much simpler to select the option of “Beginning of Current Month.”
The UI portion won’t be covered here; I will save that for another post. However, behind the scenes, you’ll want to add the following to your Reporting Server Profile:
-SET &&BOM=EDIT(&&YESTERDAY,’999999′) | ’01’;
What the above does is sets the global variable, &&BOM to the first day of the month.
When the user selects “Beginning of Current Month”, it will pass the value “&&BOM” to the WF content.
Here are some more calculations:
-* &YYMD is todays date
-SET &&YESTERDAY=AYMD(&YYMD,-1,’I8YYMD’);
-SET &&CYEAR=EDIT(&&YESTERDAY,’9999′);
-SET &&LYEAR=&&CYEAR-1;
-SET &&CMTH_DATE=EDIT(&&YESTERDAY,’999999′) | ’01’;
-SET &&BOM=EDIT(&&YESTERDAY,’999999′) | ’01’;
-SET &&P7DAY=AYMD(&YYMD,-7,’I8YYMD’);
-SET &&P21DAY=AYMD(&YYMD,-21,’I8YYMD’);
-SET &&P30DAY=AYMD(&YYMD,-30,’I8YYMD’);
-SET &TODAY_MONTH=&&YESTERDAY/100;
-SET &WS_P6MTH=AYM(&TODAY_MONTH, -6, ‘I6YYM’);
-SET &&P6MTH=EDIT(&WS_P6MTH,’99999901′);
-SET &&SAMEPERIOD_LSTYR=&&LYEAR || EDIT(&&YESTERDAY,’$$$$9999′);
-SET &&LYEAR_DATE=&&LYEAR || ’01’||’01’;
-SET &&CYEAR_DATE=&&CYEAR || ’01’||’01’;
-SET &&BOW = DATECVT(DATEMOV(DATECVT(&YYMD, ‘I8YYMD’, ‘YYMD’), ‘BOW’),’YYMD’, ‘I8YYMD’);
-* DATE CREATION FOR ALPHA DATES
-SET &&YESTERDAYA=EDIT(&&YESTERDAY,’9999/99/99′);
-SET &&SAMEPERIOD_LSTYRA=EDIT(&&SAMEPERIOD_LSTYR,’9999/99/99′);
-SET &&LYEAR_DATEA=EDIT(&&LYEAR_DATE,’9999/99/99′);
-SET &&CYEAR_DATEA=EDIT(&&CYEAR_DATE,’9999/99/99′);