Segment grouping of unconventional statistics in the computing Report of rundry Sets

Source: Internet
Author: User

During report development, some reports that require unconventional statistics, such as fixed groups, repeatable groups, and group sorting, also include reports computed across row groups, even some reports do not have data sources and need to be computed on the data sources. These reports have some special characteristics and are often difficult to implement using conventional methods.

For reports that are grouped by segments, you can repeat each segment to create reports that can be grouped by segments. A set computing report is relatively simple to complete this type of special statistical report. Here, an instance is used to describe the implementation process.

Report description

Based on the basic information table of employees, the total number of employees and bonuses of each age group are collected by age. The report style is as follows:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/C8/wKiom1RZuYiQw9F7AADDXoIBbd8400.jpg "style =" float: none; "Title =" report5_statistical_group_1.jpg "alt =" wkiom1rzuyiqw9f7aaddxoibbd8400.jpg "/>

Here, "30-40" and "35-45" are duplicated. Next we will compare the differences in the implementation of the rundry report and the centralized computing report.

 

The trouble with this report is that the grouping needs to be repeated, and the report needs to complete complicated data computing, but the computing capability of the report tool is generally weak, if you use the report tool itself to complete this computation, it will be quite complicated. For example, if you use the rundry report tool, it will be like this:

In a dry report, this type of report is mainly completed through the DS. enumgroup () function. The Report Template and expression are as follows:


650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/C7/wKioL1RZuerzvUkoAACOEi8znbY649.jpg "style =" float: none; "Title =" report5_statistical_group_2.jpg "alt =" wkiol1rzuerzvukoaacoei8znby649.jpg "/>

The expression of cell A2 is:

= Ds1.enumgroup (true, age (birthday)> 20 & age (birthday) <= 30, "20 to 30 years old", age (birthday)> 30 & age (birthday) <= 40, "30 to 40", age (birthday)> = 35 & age (birthday) <45, "35 to 45 years old", age (birthday)> = 45, "45 years old and above ")

 

The ds. enumgroup () function is used in the implementation of the rundry Report, which is relatively simple when the number of groups is small, which is incomparable to other report tools. However, when there are many groups and the computing is complicated, it is difficult to implement the statement. The reason is that the preparation and presentation of the report data source are mixed, and a large number of computing tasks need to be implemented in the report template. If the two parts are separated, that is: the Independent Computing layer is responsible for preparing data sources (completing complex computing) and the Independent presentation layer for report presentation, which makes report development clearer.

 

Therefore, the other method is to prepare data computing in advance, and the report tool only needs to be responsible for presentation and simple computing. However, no matter how complex SQL statements, stored procedures, and custom Java dataset programming are used, such complex operations (the actual situation is often more complicated than this example) it is a heavy workload and difficult to maintain.

The computing report itself has built-in scripts suitable for structured computing, allowing you to easily write data preparation calculations (equivalent to a simpler user-defined dataset ). The preceding report requirements can be completed using the set computing report as follows:

Use a set computing report

Compile the computing script

UseComputing Script EditorWrite a set computing script to create the data source demo2:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/C8/wKiom1RZuYmyB1OFAACahZBB8PU073.jpg "style =" float: none; "Title =" report5_statistical_group_3.jpg "alt =" wkiom1rzuymyb1ofaacahzbb8pu073.jpg "/>

Write a script to complete the summary calculation by segment grouping:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4D/C7/wKioL1RZue3joUfLAAIPb_JtRDs757.jpg "style =" float: none; "Title =" report5_statistical_group_4.jpg "alt =" wkiol1rzue3jouflaaipb_jtrds757.jpg "/>

A1: connect to the data source demo2;

A2: retrieve employee table data;

A3: add the Date Field and fill the field based on the birth date;

A4-A5: Specifies the segmentation interval and interval name, Here A4 and A5 contentParameters can be passed;

A6: groups based on a given age group,A. Enum ()The function provides @ rOption;

A7: Collect employee salary, bonus, and other data;

A8: return result set of the report.

Edit a Report Template

UseComputing report editor, Set the data source for report preview:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4D/C8/wKiom1RZuYvxo7bRAACXxsv2dbs631.jpg "style =" float: none; "Title =" report5_statistical_group_5.jpg "alt =" wkiom1rzuyvxo7braacxxsv2dbs631.jpg "/>

Create a report template and set the dataset. Call the preceding edited script file:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/C7/wKioL1RZue6QqKLiAADcQjcwSLk985.jpg "style =" float: none; "Title =" report5_statistical_group_6.jpg "alt =" wkiol1rzue6qqkliaadcqjcwslk985.jpg "/>

The DFX file path can be either an absolute or relative path, and the relative path is the DFX home directory configured in the relative options.

 

The Report Template and expression are as follows:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/C8/wKiom1RZuYyDMNhuAABrzbkBx7s405.jpg "style =" float: none; "Title =" report5_statistical_group_7.jpg "alt =" wkiom1rzuyydmn1_abrzbkbx7s405.jpg "/>

As you can see, you can quickly complete this type of special grouping report using the set calculator script. In addition, the external computing script has a visual editing and debugging environment, and the edited script can be reused (called by other reports or programs ). However, if the script has been debugged and does not need to be reused, It is troublesome to maintain consistency between the two files (the Set Computing script and Report Template, in this case, it is easier to directly use the script dataset of the Set Computing report.

In the script dataset, you can write scripts to complete computing tasks step by step. The syntax is the same as that of the Set calculator. You can also directly use the data sources and parameters defined in the report. The second report requirement is described as an example. You can use the script dataset as follows:

1. Click "add" in the dataset settings window. The dataset Type dialog box is displayed. Select "script dataset ";

2. Compile the script in the pop-up script dataset editing window;

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/C7/wKioL1RZue_QKqJxAAHbbdhvfus755.jpg "style =" float: none; "Title =" report5_statistical_group_8.jpg "alt =" wkiol1rzue_qkqjxaahbbdhvfus755.jpg "/>

Here we can see that the data source demo defined in the report is directly used in the script dataset, which is simpler and more direct than the separate set computing script.

3. The report template and expression are the same as those using the dataset of the cube.


Segment grouping of unconventional statistics in the computing Report of rundry Sets

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.