This is a migrated thread and some comments may be shown as answers.

Run Sub Report Conditionally

2 Answers 491 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 16 Oct 2019, 03:54 PM

     Hi All , hope you can help here.... trying to setup a sub report only to run based on a user selection. Can this be done with an expression in the sub report property box (reportsource= or or binding)? If binding I'm not sure how to bind the parameter as the drop down only gives me ReportSource. I saw a post that suggests I can do this not explain how. 

 

2 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 21 Oct 2019, 08:38 AM

Hi Steve,

You may set the report source with an Expression in the ReportSource property of the SubReport item. For example, when you select the source to be 'URL or file', the ReportSource will be created as a UriReportSource. Then, you may set the 'Select a file or enter a valid URL' to be an expression pointing to a valid TRDP/X file.

You may also use Bindings to set the ReportSource property. Note that you need to provide a valid ReportSource implementation, e.g UriReportSource, TypeReportSource, etc. - check ReportSources. This can be done with a User Function.

Another option is to provide the ReportSource type by selecting an option in the ReportSource property of the SubReport item. For example, you may select 'URL or file', which will force the Reporting engine to create a UriReportSource. You may type any value for the URL as it will be overridden later with the Bindings. Then, in the Bindings, you may set ReportSource.Uri property of the SubReport item to a valid path to the TRDP/X report, as with the first approach. Note that this property will not be displayed and should be manually typed.

I have attached a sample report with two SubReport items demonstrating the first (directly set ReportSource with Expression - check subReport1) and the last (UriReportSource with Bindings - check subReport2) approaches. The subreports are also included in the attached package. You may select from two subreports in both SubReport items - their values are set as AvailableValues of two Report Parameters.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Steve
Top achievements
Rank 1
answered on 22 Oct 2019, 03:21 PM
First solution worked, many thanks!
Tags
Report Designer (standalone)
Asked by
Steve
Top achievements
Rank 1
Answers by
Todor
Telerik team
Steve
Top achievements
Rank 1
Share this question
or