Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Custom Default Dates for DateTime parameters
berk123
Hi,
I am populating dates from database for the 2 DateTime parameters(Start Date and End Date) I have in my report. I want to show default value of current date as End Date and current date -7 days as Start Date. Please let me know how can I achieve this.
Thanks.
Find more posts tagged with
Comments
cypherdj
Hi,
in Birt 2.2.2, you cannot use an expression for the default value of your parameters.
However, what you could do is make the parameter a hidden dynamic list box, by linking it to a data set, which would return:
select sysdate from dual
and
select sysdate + 7 from dual
Obviously, if you wish for the user to override these values at runtime, then a hidden parameter might not be the answer for you. But if you do not have this requirement, I guess the question that follows is do you really need those dates to be actual report parameters. You could as easily use data set filter. For instance, if you have a column row["mydate"], you could create a filter on this column where row["mydate"] is between value1 (build expression: new Date()) and value2 (build expression: DateTimeSpan.addDate(new Date(), 0, 0, 7)).
Hope this helps,
Cedric
mwilliams
Hi berk123,<br />
<br />
Here is an example from the devShare that shows you one way you can get close to what you're looking for using scripted data sets. This example has drop down boxes for the start and end dates that have the current date and a week prior's date ready for the user to select....then another possible input for start and end date for the user to enter specific dates. This is just an example of one way to do it.<br />
<br />
Ideally in your case, you'd write a custom JSP page that has the default date range set to the current date and 7 days previous and have a calendar drop-down for the user if they want to select a different range.<br />
<br />
Hope this helps.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/deploying-birt-reports/298-2-2-birt-tag-library/'>http://www.birt-exchange.com/devshare/deploying-birt-reports/298-2-2-birt-tag-library/</a>
;
mwilliams
berk123,
Sorry..forgot to include the report design that has the scripted dataSets. The link I sent was the designing custom parameter page tips resource. The report design is attached now.
Also, are your past posts about cascaded date parameters linked to this same issue? If so, I'll tie them all together with a link to this thread. Just let me know. Thanks.
berk123
Thanks so much Cedric and mwilliams. I was getting the null setparameter error listed in my previous posts because I didn't have default values set for my start date and I guess even though the parameters are cascaded both the start date and the end date queries are executed as soon as the report starts. Since there was no default value for the start date, the end date query didn't run with null as select start date parameter.
I'd appreciate if you can suggest me how to move from 2.2 to 2.3. I want to make sure my app is using the latest version of Birt.
Thanks,