Friday 4 March 2016

Tip : Cascading parameters - Multi select & check box(boolean true or false) in Jasper Reports

Hi Folks,

This tip is useful if you are loading thousands of values into an input control(single/multi).
How  much time the input control pane is taking to load when you run a large report in which one of the parameter is having thousands of values in it.

The end user(lets say a banking employee) might get nervous to wait for the input pane window opened to run this report(imagine if he will be waiting for 3 to 5 min to load the input pane itself, how much time he/she would has to wait to load the report  - Of course, it is based on your SQL logic but lets say your report is executing in 5 min b'z of heavy transnational data)

Add a check box(boolean) parameter to your input controls pane window and pass this parameter to all your other parameters in the report - i.e., cascade all the other parameters with this boolean parameter.

Once you cascade all the parameters, now when you run the report, the input controls pane for that report will load in matter of seconds hence the user will get experienced of the report is loading.

Lets' see an example for cascading use case with multi select parameter and boolean value

Explaining only on server side :  Cascade "paramCity" multi select parameter with boolean check box parameter. i.e., when you check the tick box then the values in "City" parameter should get loaded.

SELECT distinct state_province,city FROM customer WHERE 'true'=$P{param_CheckMe}

NOTE : In jasper boolean parameters returns true or false. While cascading make sure true should be given in single quotes as shown in above SQL code. 

and the other parameter is "paramCheckMe" is of type "boolean" created.

Screenshots : 



No values populated in "City" parameter when unchecking the boolean parameter (uncheck)

Values populated in "City" parameter when checking the boolean parameter (uncheck)

I hope this helps some one.!

No comments:

Post a Comment