# Bind Nested Data Regions to Different Datasets

Learn how to use a filter or a parameter to display data in nested data regions that are bound to different data using ActiveReports.

## Content



In Page and RDLX 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 [DataSetParameters](/activereportsnet/api/v19.2/MESCIUS.ActiveReports.Core.Rdl/GrapeCity.ActiveReports.PageReportModel.DataRegion.html) property.

Binding data regions to different data is available for all data regions that you can use in Page and RDLX reports, that is [Tablix](/activereportsnet/docs/v19.2/report-authors/report-controls/report-controls-page-rdl-report/tablix), [List](/activereportsnet/docs/v19.2/report-authors/report-controls/report-controls-page-rdl-report/list), [Chart](/activereportsnet/docs/v19.2/report-authors/report-controls/report-controls-page-rdl-report/chart-page-rdl), [BandedList](/activereportsnet/docs/v19.2/report-authors/report-controls/report-controls-page-rdl-report/bandedlist), [Table](/activereportsnet/docs/v19.2/report-authors/report-controls/report-controls-page-rdl-report/table), and [Sparkline](/activereportsnet/docs/v19.2/report-authors/report-controls/report-controls-page-rdl-report/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 nested Table data regions, each data region bound to a different dataset - **Products** (Table1), **Invoices** (Table2), and **Customers** (Table3).

![Nested Data Regions at design-time](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/bind-reports/nesteddataregions_design.png)

![Nested Data Regions at run-time](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/bind-reports/nesteddataregions_runtime.png)

### 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 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**.
    
    ![DataSetParameters Editor](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/bind-reports/datasetparametereditor.png)
    
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**<br />![DataSet - Query dialog box](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/bind-reports/nesteddatasetquery.png)

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

[Demo: Nested Controls](https://developer.mescius.com/activereportsnet/demos/layouts/nested-controls)