Hidden Subreport executes datasource

2 posts, 0 answers
  1. Ricky
    Ricky avatar
    23 posts
    Member since:
    Feb 2011

    Posted 19 Nov 2014 Link to this post

    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?
  2. Nasko
    Admin
    Nasko avatar
    1064 posts

    Posted 21 Nov 2014 Link to this post

    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.

     
Back to Top