Home
Analytics
How to set today's date as default parameter value?
bsolnek
My report has two parameters, FromDate and ToDate. Both are of data type Date and display type Text Box. I've set FromDate to have a default value of 2009-01-01.
I would like to set the ToDate parameter dafault to today's date but the only script I see for the parameter is validate().
I would use something like:
java.util.Calendar.getInstance().get(java.util.Calendar.YEAR) + "-" + (java.util.Calendar.getInstance().get(java.util.Calendar.MONTH) + 1 ) + "-" + java.util.Calendar.getInstance().get(java.util.Calendar.DAY_OF_MONTH);
to polulate the default value, but where would I place the code?
Find more posts tagged with
Comments
mwilliams
Hi bsolnek,<br />
<br />
Here is a past thread on this topic. In it, I pointed them to a thread that contains an example of using a scripted dataSource to do this.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/forum/designing-birt-reports/11877-report-parameter-default-todays.html'>http://www.birt-exchange.org/forum/designing-birt-reports/11877-report-parameter-default-todays.html</a>
;
bsolnek
Thanks Michael,
As suggested in that thread, I created a data set that returns the currect date. I use that date in a dynamic combo box with the current date as the only selection. This solution works, I just wish the BIRT combo box wasn't so clunky (i.e. implemented with two radio controls).