Warning on 1.8 JasperReports bug

Testing of the 1.8 alpha release has revealed a bug in the parameter handling in the JasperReports code used by OpenVPMS when running reports from the Reporting|Reports page.

While the upgrade of this code to allow the use of iReports 5.0.4 and above brings several useful features, it breaks the handling of dependent (also called cascading) parameters, that is, where one parameter is derived from another.

This facility is not used in the standard reports, but is known to be in use some reports used in some practices, where typically it is used to allow the user to enter a selection parameter (eg to select products with names starting say 'hills') without have to add a trailing %.

The technique is as follows: If the name of the selection parameter prompted for is say ProdSelect then one defines a dependent parameter ProdSelect1 which is set using the expression

($P{ProdSelect}==null)?"%":$P{ProdSelect}+"%"

This then used in the SQL query.  Under 1.7 this worked. Under 1.8 it does not - the dependent parameter has the value Null rather than that set as per the above expression.

The fix is to change the SQL from say

   … where p.name like $P{ProdSelect1}

to

   … where p.name like concat(ifnull($P{ProdSelect},""),"%")

 

Reports currently being used under 1.7 can be modified now to make the above change. This will mean that that when you upgrade to 1.8 the JasperReports bug will not cause you problems. (Note that the bug is reported as causing a problem with groovy code - but it also causes problems in the SQL query.)

 

Syndicate content