Using Jasper report to realize the growth rate calculation of cross-reporting

Source: Internet
Author: User
Tags crosstab

Source: Http://community.jaspersoft.com/questions/847490/how-get-annual-growth-rate-crosstab

Each column of the crosstab is dynamically generated, it is necessary to use dynamic reference for inter-column calculation, it is difficult to implement this kind of requirement with Jasper script, it is relatively simple to use the collector in the data preparation phase, the following example is illustrated.

The database table store stores sales for a variety of products in 2014 and 2015, requires a cross-table to represent each product's annual sales volume, and calculates the annual growth rate of each product. Some of the source data are as follows:

The Collector code:


A1: Take out the store table record.

A2: Additional annual growth rate of each product. Group is grouped by product, run calculates each group of data sequentially, records append record,~ (i) indicates the record of the current group. The A2 calculation results are as follows:

A3: Returns the result of the calculation to the report. The collector provides the JDBC interface externally, and the report tool recognizes the collector as a normal database.

Design the simplest cross-table with Jasper:

You can see the results of the report after previewing:

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Using Jasper report to achieve the growth rate of cross-reports

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.