How to pass a date value to BIRT report via querystring

birtquery-stringreport

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

Best Answer

Your report parameter probably has a data type of "DateTime". As such your passing of just the date is not sufficient. When you use the OOTB parameter request pages this is accounted for under the covers. Either change your parameter data type to "Date" or append a time signature to your parameter being supplied to the report via your page (i.e. 2009-01-01 00:00:00). Either approach should do the trick.

Good Luck!

Related Topic