Multi-Data Source hybrid scenarios are very common in report development, such as scenarios where data comes from a mix of multiple databases, databases, and files. Traditional report tools often use two methods to solve this problem: 1. Unify data into a single database to avoid cross-database queries or mixed database file queries; 2. Use advanced languages to customize datasets for reports and perform multi-data source Association operations in the program. In addition to the impact on the database and the difficulty of implementation, the report performance is often unsatisfactory.
Using the clear set computing report to effectively support heterogeneous data sources can easily complete multi-data source Association reports. Examples are provided here.
Cross-database data sources
The monthly salary payable of enterprise employees is related to the basic salary, attendance and performance of employees. The attendance information comes from the attendance system of the human resources department (hsql database ), basic salary and performance information is stored in the financial system (MySQL database. According to the two databases, the monthly salary report should be issued for employees. The following steps can be taken to complete the use of the Set Computing report:
Write computing scripts
First, use the set calculator to write the Set Computing script (salary. DFX). The content is as follows:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/47/EB/wKiom1QECrvSjszAAAFmFcMsL7M317.jpg "style =" float: none; "Title =" reprot_runqian_multiperformance_1.jpg "alt =" wkiom1qecrvsjszaaafcmsl7m317.jpg "/>
The A1-A2 connects two databases respectively;
Based on the two database connections, the A3-A5 obtains the employee, performance and attendance table data respectively;
The A6-A7 closes the database connection;
A8 associate three tables of data by employee name;
A9 create a result sequence table to calculate the pay-as-you-go billing;
A10 is the returned result set of the report.
Create report
Open the computing report designer, select File-new report from the menu bar, and click Generate blank report to create a blank report.
Set Dataset
Select Report-dataset in the menu bar, set the dataset type to "set calculator", select the computing script file edited above in the displayed dataset settings window, and create the dataset ds1.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/47/ED/wKioL1QEC9PA844PAADOtSHIWD8970.jpg "style =" float: none; "Title =" reprot_runqian_multiperformance_2.jpg "alt =" wkiol1qec9pa844paadotshiwd8970.jpg "/>
Edit a report template and Expression
The first behavior report header and the second behavior expression in the report template.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/47/EB/wKiom1QECrzj6N0rAAA_Ce33oqw268.jpg "style =" float: none; "Title =" reprot_runqian_multiperformance_3.jpg "alt =" wkiom1qecrzj6n0raaa_ce33oqw268.jpg "/
Take the employee list through A2, and B2 will pay according to the A2 extension value.
Show reports
In the report designer, select preview report in the toolbar to view the report Presentation results in the designer.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/47/ED/wKioL1QEC9Pgutq1AABfecPqoPk189.jpg "style =" float: none; "Title =" reprot_runqian_multiperformance_4.jpg "alt =" wkiol1qec9pgutq1aabfecpqopk189.jpg "/>
Database File hybrid Data Source
In addition to the effective support for cross-database multi-data source Association, It is also easy to perform hybrid operations on databases and files. Change the instance to a database or a file.
The computing script is as follows:
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/47/EB/wKiom1QECr3ivYhmAAEjUKEpdNk538.jpg "style =" float: none; "Title =" reprot_runqian_multiperformance_5.jpg "alt =" wkiom1qecr3ivyhmaaejukepdnk538.jpg "/>
Different from cross-database data source Association, a set computing report can be directly read into a file to directly perform Association computing with a database table.
Example of Multi-dataset Association in rundry computing reports