Tuesday, February 28, 2012

Jasper Reports Performance

When a report returns large number of rows, the 'ignore pagination' property of the report should be set to false. If it is set true, the performance of the report is slow to render all the rows in a single page.

For cross tab reports, when the 'ignore pagination' is set false, the cross tab header will repeat every page when the report is export in to excel. To solve this issue, 'Repeat Column Headers' property of the cross tab should be set to false.

Monday, February 6, 2012

Returning value from Sub Report

When we return value from sub report to main report, we need to create a variable in the sub report to assign the field value, which we want to return.

For example if we want to return Sum, which we calculated using query in the subreport, we need to create a variable called sum, then assign variable expression as $F{sum}. Calculation, Reset type and Increment type should be set to None. Class variable should be of the type of Field.

Then we need to create a variable in the main report to pass the subreport value. Select the same variable as 'Variable Expression'. Calculation, Reset type and Increment type should be set to None. Class variable should be of the type of Field.

Select subreport in the main report, click on 'Return Values' in the properties. Click on Add. Type the Subreport Variable sum, Select the variable created in the main report as value of 'Local destination variable', Select 'Nothing' as 'Calculation type' and click on OK.