ActiveReports 12
Nested Data Regions Bound to Different Data
ActiveReports 12 > ActiveReports User Guide > Concepts > Page Report/RDL Report Concepts > Nested Data Regions Bound to Different Data

Now in Page and RDL reports, you can use nested data regions that are bound to different datasets. To display data, you can either use a filter for a nested data region or a parameter that is set in the new DataSetParameters property.

Binding data regions to different data is available for all data regions that you can use in Page and RDL Reports, that is TablixListChartBandedListTable, and Sparkline.

The report below shows the customer's contact name and phone information for products that are still in stock. The report layout consists of three (3) nested Table data regions, each data region bound to a different dataset - Products (Table1), Invoices (Table2), and Customers (Table3).

 

Using a filter

To display data in nested data regions that are bound to different data, you can set a filter in the Table - Filters dialog. This filter will contain the value from a nested data region in the left side and the value from a parent data region in the right side of it.

In the sample report above, two (2) filters are created. For the Table2 data region bound to the Invoices dataset, we create the filter with the expression [ProductID]=[ProductID]. For the Table3 data region bound to the Customers dataset, we create the filter with the expression [CustomerID]=[CustomerID].

As a result, the report shows the Product Name and Units In Stock information from the Products dataset. For each Product Name, the report shows the Customer Name information from the Invoices dataset and the Contact Name and Phone information from the Customers dataset.

Using a parameter

Setting a parameter in the DataSetParameters property also allows displaying data in nested data regions that are bound to different datasets. The basic steps are as follows.

  1. In the DataSetParameters property of a data region, add a new parameter, for example, productID.

  2. In the data region’s dataset, add a new parameter - productID.
  3. In the data region’s dataset, add a substring with the parameter to the existing dataset query, for example: WHERE productID = @productID

For the sample report layout above, two parameters are created. For the Table2 data region, bound to the Invoices dataset, we create the parameter productID and modify the dataset query as select * from Invoices where productID = @productID. For the Table3 data region, bound to the Customers dataset, we create the parameter customerID and modify the dataset query as select * from Invoices where customerID = @customerID.

As a result, the report shows the Product Name and Units In Stock information from the Products dataset. For each Product Name, the report shows the Customer Name information from the Invoices dataset and the Contact Name and Phone information from the Customers dataset.

See Also