New to Telerik Reporting? Request free 30-day trial

Connecting Two Data Sources within a Single Table

Environment

Property Value
Product Progress Telerik Reporting

Description

I need to use aggregate data from two data sources within a single table in Telerik Reporting. The goal is to find the difference between the total numbers from both sources.


Solution

To achieve this, you can use a SubReport as a workaround since there is no built-in mechanism for combining data across different data sources in Telerik Reporting. Follow these steps:

  1. Create a subreport definition that will contain the logic to calculate the difference between the two totals.
  2. Reference the subreport in a SubReport item that is placed in the Table Header/Footer of the main report table that uses the first data source. Let the SubReport item have the second source as a DataSource in the main report definition, or set the DataSource directly in the subreport definition.
  3. Pass the main report table total as a parameter to the SubReport ReportSource.
  4. In the subreport definition, use the passed parameter to calculate the difference with its total.

Refer to the attached sample main report and its subreport for a demonstration of this solution.


Notes

Keep in mind that this workaround involves using a SubReport and passing parameters between the main report and the SubReport to perform the desired calculations.

Sample Reports

In this article