is there any sample to use business object as report source

Posted by: gli on 22 March 2018, 3:59 pm EST

  • Posted 22 March 2018, 3:59 pm EST

    just want to know is there any sample to use object like List<object> as data source?
    I need get database without access database
  • Replied 26 March 2018, 8:37 pm EST


    Please refer the attached application where FlexReport is bound to a list of objects. Hope that helps.

  • Replied 28 March 2018, 4:38 pm EST

    Hi Pragati,
    Thanks, it works well.
    but I have few more qeustion about this sample.
    for the designer, the datasource is blank, is that means I cannot use Object from dll as datasource ? I tried to connect to the flexreport.exe in this sample, but it said does not contains any supported this sample, I would like to connect to SalesPersons
    if so , how can I get master-detail report useing List<object> and object.List<subobject> ?
  • Marked as Answer

    Replied 1 April 2018, 7:57 pm EST

    Please try to implement the IC1FlexReportExternalRecordset in your custom class and return the data to data source as per your requirement.
    You can see the link below:

    A similar implementation sample for winforms installed at:
    ..\Documents\ComponentOne Samples\WinForms\C1FlexReport\CS\ExternalDataSource

  • Replied 16 May 2018, 5:10 pm EST

    Hi ,
    I tried with the exdatasource.dll in this sample, but I get the sample problem, it said no supported datasource. is it because I use the UWP version?

    also , I have gone through the code, it looks too complex for a simple external datasource? can flexreport using object from IEnuantor or IList that is much simpler?
  • Replied 17 May 2018, 6:08 pm EST


    I tried using ExtRecordset.dll in FlexReportDesigner at my end and it works correctly. Can you please let me know what do you want to refer by:
    "is it because I use the UWP version?"

    Since "ExtRecordset.dll" is a WinForms dll and the FlexReportDesigner is a WinForms application, you can use this dll with the application without issues. However, your requirement is to use IList in a UWP application, which can only be done in the code behind (and, not by using the WinForms designer).

    Please let me know if you have any additional questions on this.

  • Replied 20 May 2018, 9:18 am EST

    OK, I tried, pass the data in UWP with Ilist working well,
    the problem is the designer , I want to heve field in designer so I need pass the field name from external dll, I tried you sample , but get the screenshot I sent in the design as above.
    why it is not working in my end? I use the designer installed with flexreport UWP.
    I found in the install folder, they are 2 shortcut
    one for c1 report designer,
    one for c1 flexreport designer,
    I am using the cq flexreport designer, maybe that is why the dll not supported?
    but I need using flexreport designer as I need show in UWP.
  • Replied 20 May 2018, 3:53 pm EST

    C1FlexReportDesigner works fine at my with the "ExtRecordset.dll" assembly.
    So you can try with the latest build which can be downloaded from the link below:

    You can find a C1FlexReportDesigner application at "Apps\v4.0" location after extract the file.

  • Replied 21 May 2018, 4:03 pm EST

    Hi ,
    It still not working in my side, but I am not concern it now, I can use the database table in design and pass the object list in runtime.

    but I have new question is I cannot pass datasource to subreport
    I tried this, it pass data ok , but the parameter defined in subreport not working
    SubreportField subreport1 = report.Fields["subreport1"] as SubreportField;
    DataSource dssub = subreport1.Subreport.DataSource;
    dssub.Recordset = sales;

    each sub report return all records, but my desired is each subreport return records with filter id={parameterId}
  • Replied 22 May 2018, 11:19 pm EST

    Please find the complete code below:


    public class Category
    public int CategoryId { get; set; }
    public string CategoryName { get; set; }

    public class Product
    public int CategoryId { get; set; }
    public int ProductId { get; set; }
    public string ProductName { get; set; }


    Filter related code:

    List<Category> categories = new List<Category>();
    List<Product> products = new List<Product>();

    c1FlexReport1.DataSource.Recordset = categories; //list of category
    SubreportField subreportField = c1FlexReport1.Fields["Field1"] as SubreportField;
    subreportField.Subreport.DataSource.Recordset = products; //list of product
    ReportParameter parameter = new ReportParameter();
    parameter.Name = "paramCategory"; //parametername
    parameter.DataType = ParameterType.String;
    ReportParameterValue reportParameterValue = new ReportParameterValue();
    reportParameterValue.Name = "paramCategory"; //parameter name
    reportParameterValue.Value.Expression = "CategoryID"; //field of categories list for filter
    subreportField.Subreport.DataSource.Filter = "CategoryID=[paramCategory]"; //filter
    c1FlexViewer1.DocumentSource = c1FlexReport1;

    Hope, it clarifies for you.

  • Replied 23 May 2018, 10:56 am EST

    Hi Sonu,
    thanks , it works really well, however there is another issue, when the subreport has no record after filter applied. like this this sample, I have this error as datasource cannot open,
    I have code to return the subreport1.subreporthasdata and it returns true.

    I have attached, the source code, if you want to run and click "Master Detail" button you should see the error
  • Replied 23 May 2018, 3:31 pm EST

    Please try with the below code hope it solve your issue:

    report.DataSource.Recordset = persons;

    SubreportField subreport1 = report.Fields["subreport1"] as SubreportField;
    subreport1.Subreport.DataSource = null;
    DataSource dssub = subreport1.Subreport.DataSources[0];
    subreport1.Subreport.DataSource = dssub;
    dssub.Recordset = sales;
    ReportParameter paraId = new ReportParameter();
    paraId.Name = "spid"; //parametername
    paraId.DataType = ParameterType.String;
    ReportParameterValue paraIdValue = new ReportParameterValue();
    paraIdValue.Name = "spid"; //parameter name
    paraIdValue.Value.Expression = "id"; //field of categories list for filter
    subreport1.Subreport.DataSource.Filter = "SalePersonId=[spid]"; //filter
    subreport1.Subreport.DataSource.FilterSyntax = FilterExpressionSyntax.VBScript;
    //dssub.Filter = "SalePersonId=spid";

    SubreportField subdetail = subreport1.Subreport.Fields["Field1"] as SubreportField;
    subdetail.Subreport.DataSource = null;
    DataSource dsdetail = subdetail.Subreport.DataSources[0];
    subdetail.Subreport.DataSource = dsdetail;
    dsdetail.Recordset = saledetai;
    ReportParameter parasId = new ReportParameter();
    parasId.Name = "pSaleId"; //parametername
    parasId.DataType = ParameterType.String;
    ReportParameterValue parasIdValue = new ReportParameterValue();
    parasIdValue.Name = "pSaleId"; //parameter name
    parasIdValue.Value.Expression = "id"; //field of categories list for filter
    dsdetail.Filter = "SaleId=[pSaleId]";
    subdetail.Subreport.DataSource.FilterSyntax = FilterExpressionSyntax.VBScript;

  • Replied 23 May 2018, 4:58 pm EST

    I tried your code, however I still get the same error after 3rd subreport as before?
  • Replied 24 May 2018, 9:19 pm EST

    I escalated this issue to developer team. Will let you know as soon as there is any information from them.

    [TFS ID: 323981 for internal use only]

  • Replied 3 June 2018, 11:50 am EST

    Hi Sonu,
    is there any update on this case?
    this is very important feature that we have to get it fixed before we make decision to purchase.
    we have approved the purchase order but this is now on hold due to this problem.
    can we get this fixed ASAP?

  • Replied 3 June 2018, 8:05 pm EST


    This is in developers' to-do list. We have raised the priority of the issue. Will let you know once there is anything from them.

  • Replied 9 July 2018, 6:28 pm EST


    We are happy to let you know that the issue has been fixed now.
    In order to verify the same, please upgrade to the latest version available using C1Live (C:\Program Files (x86)\ComponentOne\C1Live) or use the following link to download the new build version:

Need extra support?

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

Learn More

Forum Channels