Easy hack for unbound BIRT report

IBM recently posted a KB doc on unbound parameters in BIRT rreport. The gist of the KB doc was this:

There is a subtle difference in the way bound vs unbound parameters are used in reports. For bound parameters, if you select a value from the lookup you will see that the value will appear with an "=" sign in front of it on the request page. For example a site parameter that is using the site lookup would appear as "=BEDFORD" after you have selected BEDFORD from the list of sites. If you run your report with this, the report will show the results for the selected site. However, if the site parameter is unbound (and there are some examples of these in our out-of-the-box reports) and you type in "=BEDFORD' as your parameter value, you will see no data on the report.

The best example I have for an out of the box unbound report is the "Issues and Returns Transaction". The report has two parameters, with one of them against the MATUSETRANS.SITEID field. But since this report runs from the Inventory module, there isn't a way to bound the MATUSETRANS.SITEID to the INVENTORY.SITEID field. So as the KB doc states, if a user tries to enter =BEDFORD, the report will fail. The out of the box parameter for the MATUSETRANS.SITEID parameter is:

maximoDataSet.setQueryParameterValue(1, params["site"].toUpperCase());

Modify the parameter to this:

maximoDataSet.setQueryParameterValue(1, params["site"].replace("=" , "").toUpperCase());

Adding .replace("=" , "") will take any instances of where a user enters =BEDFORD, strips out the = if it's present, and just passes BEDFORD.

Comments

Top