Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 1.75 KB

File metadata and controls

56 lines (43 loc) · 1.75 KB
title Change Sub Report based on Main Report's Data
description Edit Sub Report based on Main Report's Data.
type how-to
page_title Modify Sub Report based on Main Report's Data
slug change-sub-report-based-on-main-report-s-data
res_type kb

Environment

Product Progress® Telerik® Reporting
Report Item SubReport

Description

This article explains how to change the ReportSource of the SubReport based on Main Report's Data.

Solution

You can use a User Function in a Binding to the SubReport item's ReportSource property. The function should return a valid ReportSource object that wraps a report - the subreport.

For example, the following user function:

public static ReportSource SetReportSource(string field)
{
	var TRS = new TypeReportSource();
	TRS.Parameters.Add("Parameter1", field);
	if (field.ToLower() == "yes")
		TRS.TypeName = typeof(SubReport1).AssemblyQualifiedName;
	else
		TRS.TypeName = typeof(SubReport2).AssemblyQualifiedName;
	return TRS;
}

You should set the following Binding to the SubReport item in the Main report:

Property path: ReportSource

Expression: = SetReportSource(Fields.MainReportFieldX)

See Also

Extending Reporting Engine with User Functions