How to Configure Tablix with Multiple Datasets

To configure a tablix with multiple datasets in the Bold Reports® JavaScript Report Designer, set the enableTableMultipleDataAssign client-side API to True when you initialize the designer. You can then assign data from multiple datasets to a Tablix.

Create Report Designer JavaScript application

Refer to the Getting started to create a Report Designer JavaScript application.

How do I enable multiple datasets in a tablix in the JavaScript Report Designer?

During the initialization of the Report Designer control, set the enableTableMultipleDataAssign property to True. When this property is enabled, you can bind data from multiple datasets to a Tablix. The dataset assigned in the Dataset Property of tablix is bound to tablix, while fields from other datasets are considered as expression.

Add the following code within the <body> tag of the Report Designer HTML page.

    <!-- Creating a div tag which will act as a container for boldReportDesigner widget.-->
    <div style="height: 600px; width: 950px; min-height: 400px;" id="designer"></div>
    <script type="text/javascript">
        $(function () {
            $("#designer").boldReportDesigner({
                serviceUrl: "https://demos.boldreports.com/services/api/ReportingAPI",
                enableTableMultipleDataAssign: true
            });
        });
    </script>

When you run the application, the Report Designer renders as follows:

Report designer

Create dataset

Refer to the Create Data section to create multiple datasets in the report. This example uses the AdventuresWorks database.

Add a table to the report

  1. The table report item is listed in the item panel under the Data Regions category. Tablix listed in item panel
  2. Drag and drop the table report item into the design area from the item panel. Drag and drop tablix report item into design area
  3. The respective table properties will be displayed in the properties panel. Tablix item with properties view

Assign data to the tablix

  1. Select any cell within the Tablix data region. Click the Data assign menu icon to open the data assign menu. Data assign menu

  2. The available datasets in the report will be displayed in the dropdown menu of the data assign menu. Data assign dropdown

  3. Select the fields SalesOrderID, ModifiedDate, and OrderQty from DataSet1. The selected fields will be assigned to the corresponding cells. First dataset fields assign

  4. Choose Dataset2 from the dropdown menu. The respective fields are listed. Another dataset fields assign

  5. The fields Name and UnitPrice assigned from DataSet2 will be considered as expressions. Expression data assign

Calculate a item total

To calculate the item total, refer to the Assign expression in cell section and assign the following expression to the last cell: =Fields!OrderQty.Value * First(Fields!UnitPrice.Value, "DataSet2"). Item total

Format tablix design

In the following design, the background color and font styles in the Tablix cells have been updated to enhance the report design. Formatted tablix design

Report preview

The report preview displays the Product Sales Report. Report preview

Download the preceding report design from the tablix report with multiple datasets on GitHub.