Use Jasper report to calculate the growth rate of the Cross report.
Source: http://community.jaspersoft.com/questions/847490/how-get-annual-growth-rate-crosstab
Each column in The crosstab chart is dynamically generated and must be dynamically referenced during inter-column computation. It is difficult to use the Jasper script to implement such a requirement, it is relatively simple to use the set calculator in the data preparation stage. The following example shows how to use it.
Database Table store stores the sales volume of Multiple Products in 2014 and 2015. You need to use a cross tabulation to present the annual sales volume of each product and calculate the annual growth rate of each product. Some source data is as follows:
Code of the Set calculator:
A1: retrieve records from the store table.
A2: annual growth rate of each additional product. Group is grouped by product, and run is used to calculate each group of data in sequence. record append records ,~ (I) indicates the I record in the current group. The calculation result of A2 is as follows:
A3: return the calculation result to the report. The assembler provides a JDBC interface. The report tool recognizes the assembler as a common database.
Use Jasper to design the simplest cross tabulation:
After previewing, you can see the report results:
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.