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 GrapeCity.ActiveReports.PageReportModel.DataRegion.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 Tablix, List, Chart, BandedList, Table, 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).
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.
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.
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.