There are some reports in the report system that are often connected to different data sources according to the conditions to complete the report presentation. The need to switch between different data sources is what we call Dynamic Data sources. General reporting tools to implement dynamic data sources often rely on third-party programs (Java, etc.) implementation, run-dry set of reports can be completed through the built-in script, this article will be an example to understand the implementation process.
Report description
Student information through the parameters of the data source Control report connection, the parameter status is 1 o'clock connection data source One (dev_1), otherwise connected to the data source two (dev_2), according to the class summary student total.
In a set report, you connect different data sources by completing the parameters of the set-up script, and then use the result set returned by the script in the report template, as you would with a data source. The following are the specific steps:
Edit a report template
You first need to create a new two data source (Dev_1 and Dev_2) for report development.
Use the collection Report Designer to create a new report template and set report parameters, datasets, and report expressions.
Set Report Parameters
The status is used to control the data source of the connection, which defaults to 1 and connects Dev_1.
Set up datasets
Use the script dataset to determine the connected data source based on the parameters and complete the calculation of the fetch:
In A1 according to the report parameters to determine the data source to be connected, A2 complete the data query, the results are returned through A4.
To set a report expression
Edit the report expression, use the result set returned by the collection script directly, and complete the report production using a simple report expression.
As you can see, it is easier and straightforward to use a script dataset to make a dynamic Data source connection without having to do it in a Java program by simply judging it by receiving report parameters.
See the script data set in: http://blog.csdn.net/u012388497/article/details/40076481.
Implementing a Dynamic Data source for a report with a script