views:

560

answers:

2

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

+2  A: 

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!

MystikSpiral
Thanks MystikSpiral - Since my post, I resolved the issue myself and the fix was related to what you mentioned. My report parameter was of data type "date time" and I actually changed it to string. That fixed the issue. The SQL query within my dataset was ok with accepting a string as the parameter - as long as it was formatted to MySQL's date format.
Tommy
A: 

If the start date parameter you are passing is 2000-01-01, why is it giving you an error message saying 06-08-2010 is invalid? It looks as though the date parameter is being set elsewhere within the report, either as a default value or possibly within an event script.

Mark Bannister
Thanks Mark, I used a mix of different examples of the error in my post. Sorry for confusion
Tommy
Oh, I see - thanks.
Mark Bannister