Run Sub Report Conditionally

3 posts, 0 answers
  1. Steve
    Steve avatar
    2 posts
    Member since:
    Oct 2019

    Posted 16 Oct 2019 Link to this post

         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. Todor
    Admin
    Todor avatar
    451 posts

    Posted 21 Oct 2019 Link to this post

    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
  3. Steve
    Steve avatar
    2 posts
    Member since:
    Oct 2019

    Posted 22 Oct 2019 in reply to Todor Link to this post

    First solution worked, many thanks!
Back to Top