开发者

How do you pass a date value to BIRT report via querystring

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 soluti开发者_JS百科on 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


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!


The following is the format BIRT appears to use for validation of parameters:

DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"

So if you pass in date/time as it should work

&mydate=2009-11-22 00:00:00.0


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.


Check your date format; remember that MM is used for month and mm for minutes.

Also check this solution, found at the Eclipse Community Forums:

Try this in the URL:

&mydate=22/11/2009&__islocale=mydate

Replace mydate with your parameter name. The __isLocale parameter specifies that the parameter has been localized.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜