Monday, November 20, 2006

BIRT: Getting URL Parameters to Work in Reports

A question was asked about being able to pass in values from a URL, and have it do something in the report. In order to get this to work, all you need to do is create a report parameter. So, using my previous report example here, I can send a value to the rptparamCheckBox1 parameter through the URL as a URL parameter. So if I deployed my example report linked above, to an Apache BIRT Viewer instance at 127.0.0.1, I would call it with the following URL:

http://127.0.0.1:8080/birt/frameset?__report=CheckBoxReport.rptdesign&rptparamCheckBox1=false

Now, I can change the URL and have it show up in the report. This will also work with hidden parameters that you may want to use to affect layouts. So, if I add a Highlight, as indicated in Figure 1, I can have the text show up as red when the value of rptparamCheckBox1 is true.


Figure 1. Highlight Based on Parameter.

No comments: