We will introduce Linked data set function of FineReport reporting software in this article.

1. Problem description

Scenario I: One template has defined two data sets ds1 and ds2, which fetch from oracle and sqlserver, and you want to know whether the report data analysis are from ds1 or ds2 through parameter control;

Scenario II: There is one piece of template having same styles inside. However, all data are fetched from a database of each subsidiary of final customer. Now, each subsidiary is required to access to its own data;

Scenario III: The data sets ds1 and ds2 are from different data sources with same structures. Now, it is required to combine the data in the table.

The above scenarios can be realized through linked data set. Take Scenario I as an example to describe the usage method of linked data set.

2. Example

2.1 Define data set

Define data sets ds1 and ds2, which come from databases oracle and sqlserver respectively.

2.2 Use linked data set for combination

In the Data Set panel, New > Linked Data Set:

At this time, the system will list all available report data sets, server data sets and stored procedures of the report. Click required data set, for example, ds1, ds2;

Add conditions. For example, corresponding condition of ds1 is $db=”oracle”, i.e., when the parameter db is oracle, ds1 is used;

Similarly, add conditions for ds2: $db=”sqlserver”, i.e., when the parameter db is sqlserver, ds2 is used.

Note: When several data sets meet requirements at the same time, the final result will be the combined result of such data sets. Combining rules are as follows:

To combine several data sets with totally different field names, combine from the first data set from top to down, and match the same field content to one field. If different field names appear, add field name. If there is no data set for this field before combination, use a null as the field value after combination, as shown below:

3. Description of version update

This Linked Data Set Definition interface is the latest version. In V8.0, linked data set is divided into Combine and Select by Conditions,where the first one is compatible, while the latter one not (requiring re-definition).