Report example--using Birt to achieve irregular month statistics

Source: Internet
Author: User

Source: http://developer.actuate.com/community/forum/index.php?/topic/36323-months-and-quarters-group-issue/

Irregular month Statistics: If the starting time is 2014-01-10, then the 2014-01-10 to 2014-02-09 as a group, 2014-02-10 to 2014-03-9 as a group. If the start time is 2014-01-31, then 2014-02-27 is used as a group, and 2014-02-28 to 2014-03-30 as a group.

The Collector code:


A1: Queries the database based on the start and end time, where StartDate and EndDate are external parameters.

A2: Calculates the month interval based on the starting and ending time. For example, 2014-01-31 and 2014-07-31 interval 6 months.

B2: Calculates the start date of the irregular month based on the start time and date interval, and inserts the start time into the 1th position. | Represents a merge, "~" represents the current member in the collection, that is, the number 1 to 6,after function calculates the irregular month correctly. The results are as follows:


A3: The A1 is grouped by B2 interval, the sales of irregular months are counted and B2 as the last column. The function pseg can return the interval number where the data resides. The ~ in ~.sum (Amount) represents the current group after grouping. #表示A1当前组号. The calculation results are as follows:

A4: Take out the 2nd and 3rd columns of the A3 and return to the report tool. The collector provides the JDBC interface externally, and the report tool recognizes the collector as a normal database.

The following is a simple list table designed with Birt:


The report calls the collector the same way you call a stored procedure, such as saving this script as BIRTUNREGULMONTH.DFX, which you can use in the Birt stored procedure designer by calling Birtunregulmonth (?,?) To invoke. Preview the following table sample:


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

Report example--using Birt to achieve irregular month statistics

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.