A multi-data source report is a report where you can define multiple datasets, take out the database tables you need, and even get database tables from different databases. In this paper, several examples are given to illustrate how multiple data set data are interrelated to achieve multi-source reporting.
1. Description
Multiple data sources, that is, in the same report, the data displayed is from a number of different tables or different libraries.
such as a simple multi-data source report, the blue part of the left is from the sales table, the right yellow part from the Sales Totals table, that is, the data from two different database tables:
2. Example
2.1 open a single data source report
Open report %fr_home%\webreport\web-inf\reportlets\doc\primary\crossreport\cross.cpt.
2.2 New Data Source
Add another dataset, DS2, whose SQL statement is SELECT * FROM [ total Sales]. There is a salesperson field for both the DS2 dataset and the DS1 dataset.
2.3 Binding Data Columns
For example, drag and drop the total sales data column in the DS2 to the cell, and set the parent to be the salesperson's cell so that the total sales amount follows the salesperson's extension:
2.4 Set Filter
At this point, the designer previews the effect as follows:
You can see that all the data in the Sales Total field is displayed repeatedly under each salesperson that is expanded.
Although the parent of the sales totals is the Salesperson data column, because they come from different datasets, the sales totals do not filter the parent salesperson as a condition, that is, there is no affiliate relationship.
We need the sales amount to correspond with salesperson one by one, we need to set up the filter condition, associate the data of the two datasets with the salesperson.
Select the cell in which the total sales amount is located, set the filter , add filters: salesperson equals ' C4 ', take out data that matches the salesperson in cell C4, such as:
2.5 Save and preview
Save the template, preview the report, and see the effect as above.
3. Multi-data source reporting benefits
Multi-data source reporting the traditional approach is to consolidate multiple sources into a single source through the consolidation of SQL. In the example above, the sales list is integrated with the total sales table:SELECT * from sales, total sales where sales. Salesperson = Total sales. SALES Clerk . If your database tables are complex and you use more than 2 tables, you can imagine that the final SQL query statement will be very complex.
Finereport Natural support for multiple data sources of the report, a report can add any number of datasets, each dataset using the simplest SQL statement to query out the required table data, in the report only need to use filtering in the data from different tables can be linked together. Make it easier to make multi-data source reports.
A simple multi-source report for multi-data source report resolution