Multi-source and hybrid data sources of diversified computing reports

Source: Internet
Author: User

Diverse data sources are becoming more and more common in report development. the effective support of the collection and computing reports for diverse data sources makes the development of such reports very simple, currently, in addition to traditional relational databases, the data source types supported by computing reports include TXT text, Excel, JSON, HTTP, hadoop, and MongoDB.

In addition to using the preceding data sources, you can also use these data sources in a centralized computing report. Hybrid multi-data sources are another manifestation of diverse data sources in computing reports. The following describes how to use an instance.

Report description

The monthly salary payable of an employee is related to the basic salary, attendance and performance of the employee. The attendance information comes from the text file exported by the Human Resources Department from the attendance system, basic salary and performance information is stored in the financial system (hsql database. Now we need to use two pieces of data to calculate employees' salaries.

Calculation Formula for pay-as-you-go: basic salary * (1-Attendance coefficient + performance score ).

Compile the computing script

Use the computing Script Editor to write a computing script, read database data and text data, and complete associated operations.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4D/4D/wKioL1RPL_HDJQjpAAGv1Jysdkk570.jpg "style =" float: none; "Title =" report5_multisource_mixsources_1.jpg "alt =" wkiol1rpl_hdjqjpaagv1jysdk570.jpg "/>

A1: connect to the data source demo;

A2-A3: Data of employees and performance tables are obtained respectively;

A4: Close the database connection;

A5: Use F. Import () to read the attendance data in the text;

A6: left join performance and attendance table data based on employee table;

A7: calculates the salaries of employees;

A8: return result set of the report.

Edit a Report Template

Report data source connection demo

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/4C/wKiom1RPMB7xkFcmAABxb25sRlY638.jpg "Title =" report5_multisource_mixsources_2.jpg "alt =" wkiom1rpmb7xkfcmaabxb25srly638.jpg "/>

Set Dataset

Use the report designer to create a report template, set the dataset, and call the edited script.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4D/4C/wKiom1RPL9ODm4eTAADkdAVBh-I091.jpg "style =" float: none; "Title =" report5_multisource_mixsources_3.jpg "alt =" wKiom1RPL9ODm4eTAADkdAVBh-I091.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.

 

Set a report expression

Edit the report expression, directly use the result set returned by the Set Computing script, and use a simple list expression to complete report creation.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/4D/wKioL1RPMCnDF07LAABcyvOTKWk365.jpg "style =" float: none; "Title =" report5_multisource_mixsources_4.jpg "alt =" wkiol1rpmcndf07laabcyvotkwk365.jpg "/>

As you can see, you can use the set calculator script to implement hybrid computing of multiple data sources for the report, and the external set computing script has a visual editing and debugging environment, the edited script can also 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. 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/4C/wKiom1RPL9STm_2iAAGXjMdISJU426.jpg "style =" float: none; "Title =" report5_multisource_mixsources_5.jpg "alt =" wkiom1rpl9stm_2iaagxjmdisjuw.jpg "/>

In the script dataset, you can directly use the demo of the data source defined in the report for query, instead of using the connect () function to connect to the data source like an independent set computing script.

 

The report expression is the same as the dataset using the cube.




This article is from the "high performance report data computing" blog, please be sure to keep this source http://report5.blog.51cto.com/8028595/1568785

Multi-source and hybrid data sources of diversified computing 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.