March 10, 2006, 10:45 AM
BethanyReport Caster Parameters
I'm trying to set up my report to pass a date parameter of the SYSTEM_DATE -1
March 10, 2006, 11:36 AM
susannahBethany, lookup the AYMD function
it adds or subtracts days from &var dates, like
-SET &YESTERDAY = AYMD ( &YYMD , -1, 'I8YYMD');
-SET &TOMORROW = AYMD ( &YYMD , 1 , 'I8YYMD');
So, you could have a variable &ADJ as a parm
-DEFAULT &ADJ = 0 ;
-SET &YESTERDAY = AYMD ( &YYMD , &ADJ * (-1), 'I8YYMD');
So if you wanted to run for last week, then your &ADJ = 7 in your caster parms.
March 10, 2006, 12:42 PM
jodyeHi Bethany
I believe that we do exactly what you are trying to do with this post and your other post. Putting together the answers from Susannah and Francis...
This code will set &MYDATE to yesterday if there is no value for MYDATE passed as a param to the fex. Just make sure that when the report is run from caster, the MYDATE param is empty or not present, that way the default date used is yesterday.
-SET &ECHO=ALL;
-DEFAULTS &MYDATE='';
-SET &YESTERDAY=AYMD(&YYMD,-1,'I8');
-SET &MYDATE = IF &MYDATE EQ '' THEN &YESTERDAY ELSE &MYDATE;
-TYPE MYDATE = &MYDATE
When the report is not run from caster, a value is always passed for MYDATE, so that gets used instead of the default of yesterday.
Jodye
March 10, 2006, 12:47 PM
Francis MarianiThat makes sense. Cleaner.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 16, 2006, 05:27 PM
BethanyThanks for the suggestion. Anyone know if this could work with a smart date? When the user inputs the date it's sent from the launch page as a YYMD.
March 16, 2006, 11:42 PM
susannahBethany, you can convert an I8YYMD to a smart date and vice-versa, even if they're in dialog manager form. In the 'Using Functions' manual, there's a whole chapter on dates. very enlightening. you'll get a lot of ideas from it.