Use Jasper report to calculate the growth rate of the Cross report.

Source: Internet
Author: User
Tags crosstab

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.