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

Hidden Subreport executes datasource

1 Answer 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ricky
Top achievements
Rank 1
Ricky asked on 19 Nov 2014, 03:58 PM
I have a report that contains several subreports and depending on which parameters are passed will hide all irrelevant subreports.

These subreports have their own datasources that appear to execute regardless if they're visible or not.

Is it intended functionality for a hidden subreport to execute its datasource?

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 21 Nov 2014, 12:29 PM
Hello Ricky,

Even though the report items (SubReports) are not visible, they are still going to be processed by the reporting engine which is the intended behavior. In order to work around this you can remove the items from the report definition based on the user input. This requires programmatic report generation.
Note that creating a tool or a module which will generate the entire report definition on the fly based on some user defined rules and settings is not a trivial matter. In general, the fastest way to do this is to to create the desired report layout in the Visual Studio Report Designer and use the code it automatically generated in the .Designer.cs file as a template for dynamic report generation. In this undertaking you may also find useful the Programmatic Control of Reports help articles on the topic and the Reporting API Reference.

Another approach is to apply filtering on the data source level to the sub-report's data sources. When a data item is hidden in the report (Visible=False), it does not need to retrieve data in your particular scenario. Thus, if you apply filtering on the data source level based on report parameters and data source parameters, you will be able to speed up the report noticeably without having to generate reports programmatically.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Ricky
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or