Drill Into Report Controls after Render

3 posts, 0 answers
  1. James
    James avatar
    10 posts
    Member since:
    Apr 2015

    Posted 03 Nov 2017 Link to this post

    Hi. I'm wondering if it's possible to get access to the fields, textboxes, etc. on a standalone report after it's been rendered and placed onto report pages.

    When a report is printed, I need to know which specific groups on the report are being printed so that I can set a Printed flag for the order that just had it's Order Confirmation printed. I can get the page numbers which were just printed, but now I need to know which page(s) the groups were rendered on.

    Thanks for your time.

  2. James
    James avatar
    10 posts
    Member since:
    Apr 2015

    Posted 29 Nov 2017 Link to this post

    So is this possible? Is there a way I can determine which groups were rendered onto which pages, either during or after rendering?
  3. Todor
    Todor avatar
    451 posts

    Posted 04 Dec 2017 Link to this post

    Hi James,

    In Telerik Reporting it is possible to access the data Fields after they have been rendered on the page. This could be done in the page header or footer sections since their Item expressions are evaluated after paging has finished, as explained in the Report Life Cycle help article.

    For example, if you need all the distinct items from a specific group that have been rendered on the current page, I could suggest you to use the AllDistinctValues aggregate function (more on aggregate functions could be read here), evaluated in the scope of the particular group (indicated with its name, i.e. "groupName") as arguments of the PageExec function, i.e. 'PageExec("groupName", AllDistinctValues(Fields.fieldNameOrSomeExpression))'. This function would return all the distinct Fields.fieldNameOrSomeExpression of the "groupName" groups that have been rendered on that page. Note that even if only part of the group is rendered on the page, the entire group of values would be returned.

    The collection of values returned by the PageExec could then be passed as an argument of a custom user function that could use them in the desired way. How to extend expressions with User Functions is explained here. Note that it would be necessary to extend the Standalone designer with the assembly of the User function, as explained in this article. The configuration file of the Standalone designer that should be modified is named Telerik.ReportDesigner.exe.config and could be found in (Telerik Reporting installation folder)\Report Designer (for example C:\Program Files (x86)\Progress\Telerik Reporting R3 2017\Report Designer) folder. The assembly itself should be copied to the same folder. The properly added User Function would appear under the Edit Expression Wizard->Functions->Misc->(The Class of the function).

    I have prepared a sample report that uses such a user function to display all distinct 'name' fields that have been rendered on each page. The appropriate list of names is displayed on each page header. The Report, the Assembly, and the C# code of the Function could be found in the attached .zip file. The Assembly should be copied to the Standalone designer folder, and the designer config file should be modified as explained above.

    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
Back to Top