How do you pass a date value to BIRT report via querystring
Posted
by Tommy
on Stack Overflow
See other posts from Stack Overflow
or by Tommy
Published on 2010-06-14T10:53:08Z
Indexed on
2010/06/14
22:52 UTC
Read the original article
Hit count: 1536
Hi, I have made a static html page (called start.jsp) containing a form where the user select 2 date ranges and this form has date pickers for those text boxes. When the user submits the form, it should take them to the BIRT report that I have designed. It SHOULD pass the 2 parameters that my report needs (start date and end date).
Here is the querystring that gets appended to the URL birt-viewer/run__report=Business_Activity_Monitoring.rptdesign &FilterStartDate=2000-01-01&FilterEndDate=2009-01-01
I get an invalid date error: org.eclipse.birt.report.exception.ViewerValidationException: The parameter "FilterStartDate" is invalid. The value "06-08-2010" is invalid with the type "dateTime".
How is it that if I remove the querystring completely, then BIRT will prompt me to enter the start date and end date (screenshot attached). I enter the exact same data that the form tries to send and it works!?
This proves that my date string is correctly formatted but yet it will not accept them if they are sent to the BIRT report via the querystring? Seems like it has a problem with the fact that its a string in the first place.
I have correctly set up these report parameters in my BIRT report. I have also tried changing them by specifying the "Format as" value to be a "custom" YYYY-MM-dd but this didnt work.
Is it even possible to send date parameters to a birt report via querystring?
Im guessing the solution will involve converting these strings to dates within the birt report's "script" tab. but I dont know how to access querystring variables from here or how to set report parameter variables.
Thanks -Tommy
© Stack Overflow or respective owner