Data source re-calculation of non-routine statistics of run-dry set calculation report

Source: Internet
Author: User

There are a number of reports, after taking a certain amount of calculation can be used to show the output of the report, which requires the report tool has the ability to recalculate the data source.

Traditional tools rely on the computing power of the reporting tools themselves, but weak reporting tools result in a lot of computations, or with stored procedures (if the data originates from a database), and no matter how difficult it is to write a stored procedure, such as a cross-library or database file hybrid data source, the stored procedure simply cannot be completed Have to use a high-level language to provide data source recalculation for a report custom data source, but it is not easy for Java to do things like set operations.

The collection report is simple when this is done, and this article uses an example to understand the workaround.

Report description

According to the Student performance table, the list of the top 10 students and the results of each section are listed in the first three subjects of the specified class. The Score table section data is as follows:

The report style is as follows:

The difficulty of this report is that after the data is taken, the intersection operation between different sets is completed to determine the report dataset. General reporting tools do not have a strong ability to recalculate data sources, and it can be difficult to complete such reports, typically with a custom data set, and with a high degree of code complexity.

If you need to prepare the data, the reporting tools need only be responsible for rendering and simple calculation, then the process will be simpler. But whether you're programming with complex SQL, stored procedures, or custom Java datasets, it's a lot of work and difficult to maintain for such a complex operation, which is often more cumbersome than this example.

The collection report itself has a script for structured computing that makes it easy to write the calculations for data preparation (which is equivalent to a more user-friendly custom dataset).

Writing a collection script

Use the system default data source demo first using the collection Script Editor .

Set the script parameters to receive the class name that the report passes over.

Write a script to complete the data source recalculation task to output the computed result set for the report.

A1: Connecting data sources;

A2: According to the class parameters to take this class student performance data;

A3-A5: The first 10 records were sorted according to the scores of the words.

A6: Using aggregate intersection arithmetic to get the list of students with the top 10 grades in three subjects;

A7: Create the result order table according to the A6 result;

A8: The cyclic A6 respectively take the results of each section to fill the result sequence table;

A9: Returns a result set for the report.

Edit a report template

Use the collection report editor to edit report templates for data presentation. First create a new parameter and set the default value.

Create a new report and set up the collector DataSet to invoke the edited script file above.

Where the DFX file path can be either an absolute path or a relative path, the relative path is the DFX home directory configured in relative options, the parameter class is a report template parameter, Arg1 is a script parameter, and in fact the two can have the same name.

Edit the report expression to complete the report production directly using the result set returned by the collection script.

Report, you only need to show the result set generated by the script through a list expression.

You can use the collector script to quickly complete a report of this type without a data source but a rule. Moreover, the external set-up 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 would be cumbersome to maintain the consistency of the two files (both the set and report templates), which makes it easier to use the script dataset directly for the set report.

In a script dataset, you can step through a script to complete a calculation task, with the syntax consistent with the concentrator, and you can use the data sources and parameters that the report defines well. This example uses a script dataset to do this:

1. Click the "Add" button in the DataSet Settings window to pop up the dataset Type dialog and select "Script Data Set";

2. Write the script in the Popup Script dataset editing window;

As you can see here, it is simpler and more straightforward to use the parameter class defined in the report directly in the script dataset than a separate set-up script.

3. Report templates and expressions are consistent with the use of the Collector dataset, and no longer repeat them.

For more information, please visit:, collector download:

Data source re-calculation of non-routine statistics of run-dry set calculation report

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: 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.