Passing values from subReport to MainReport doesn't work on flexReports

Posted by: iqoperations on 24 February 2021, 4:00 am EST

  • Posted 24 February 2021, 4:00 am EST

    Hi,

    According to the documentation here

    Retrieving Values from Subreports (componentone.com)

    It is possible to pass values from subReport to mainReport by reading from mainReport, those directly from the subReport. (and vice versa)

    We used to use the expression MyReport.Subreport.Fields("MyField").value or MySubReport.ParentReport.Fields("MyFields").value to read those values in our C1Reports

    When we migrated to FlexReports, these expressions were returning nothing.


    I can reproduce the issue using a template bound to a sql datasource and previewing the report in the designer.

    Could you please help understanding what broke here ?

    Cordially.

    C1FlexReportDesigner.4.5.2, Version 4.5.20203.468

    C1.WPF.FlexReport 4.5.20201.697
  • Replied 24 February 2021, 9:09 pm EST

    Hi,
    Please try to use below syntax to achieving your requirement:
    Retrieving value from SubReport (Detail.OnFormat):
    [mainreportfieldname].Subreport.Fields("subreportfieldname").value

    Retrieving value from MainReport(Header.OnFormat):
    Report.ParentReport.Fields("mainreportfieldname").value


    Please find a sample report attached. You can change the event and script based on your requirement.

    If this does not work for you. Please share a small sample to reproduce the issue so that we can assist you accordingly.

    Thanks,

    TestReport.zip
  • Replied 25 February 2021, 6:50 am EST

    Hello,

    Thanks for your reply

    It is indeed working on your case but i was referring to the case when the reports are data bound to e.g sql datasource

    I can anyway reproduce the undesired behaviour on the attached sample.

    If you attach customers.xml as the main datasource of the subreport and try to render mainReport, you will see that the fields are not retrieved.


    TestReport.zip
  • Marked as Answer

    Replied 25 February 2021, 8:53 pm EST

    Hi,
    Thank you for sharing a sample report with us.
    This is the desired behavior of C1FlexReport that we cannot get the the value of a sub report field (bind to data source) . If we want to get a sub report field value in our main report then we need to create a field in sub report which is not bind to any data source field.
    However, in our old C1Report, it returns the field label (data source field name).

    Thanks,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels