Problem Upgrading From C1Report to C1FlexReport With Subreport

Posted by: gmckee on 15 October 2019, 6:06 pm EST

    • Post Options:
    • Link

    Posted 15 October 2019, 6:06 pm EST

    I am upgrading my C1Report(s) to C1FlexReport(s). Most everything has an appropriate equivalent. I have found a problem with a subreport. I dynamically set the connection string and recordset of the datasource using code.

    rpt.Fields[“rsubRegistrationExtraCharges”].Subreport.DataSource.ConnectionString = connection.ConnectionString;

    In C1Report this worked great. The documentation for the C1FlexReport seems to indicate that this will work but I get an error message at design time that says:

    FieldBase’ does not contain a definition for ‘Subreport’ and no accessible extension method ‘Subreport’ accepting a first argument of type ‘FieldBase’ could be found

    What is the resolution of this change in the object model of the C1FlesReport

    George McKee

  • Posted 16 October 2019, 7:03 am EST

    Hello George,

    Subreport property is under SubreportField class that inherits FieldBase class. You can use the code snippet given below to achieve your desired result :

    SubreportField srField = (SubreportField)_c1flxr.Fields["rsubRegistrationExtraCharges"];
    C1FlexReport rptSubreport = srField.Subreport;
    rptSubreport.DataSource.ConnectionString = connection.ConnectionString;
    rptSubreport.DataSource.Recordset = _dataTable;
    

    You can learn more about how to use SubReport in FlexReport by the product sample name “SubreportDataSource” which is found in your system at location : \Documents\ComponentOne Samples\WinForms\v4.0\C1FlexReport\CS\SubReportDataSource



    Regards,

    Prabhat Sharma.

  • Posted 21 October 2019, 10:43 pm EST

    Thanks. That helped

Need extra support?

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

Learn More

Forum Channels