This section explains how to configure the tablix with multiple datasets. In Report Designer, the enableTableMultipleDataAssign
client-side API allows you to configure data from multiple datasets into a Tablix.
Refer to the Getting started to create a Report Designer JavaScript application.
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 web 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>
Once you run the application, the report designer will render as shown below:
Refer to the Create Data section to create multiple datasets in the report. In this design section, AdventuresWorks
database is used.
Data Regions
category.
Select any cell within the Tablix data region. Click on the Data assign
menu icon to open data assign menu.
The available datasets in the report will be displayed in the dropdown menu of the data assign menu.
Select the fields SalesOrderID
, ModifiedDate
, and OrderQty
from DataSet1
. The selected fields will be assigned to the corresponding cells, as shown below.
Now, choose Dataset2
from the dropdown menu; the respective fields will be listed below.
The fields Name
and UnitPrice
assigned from DataSet2
will be considered as expressions.
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")
.
In the design below, the background color and font styles in the Tablix cells have been updated to enhance the report design.
In the report preview, the Product Sales Report will be displayed as shown below:
Download the above report design from this link.