Is there any sample to use business object as report source

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

    • Post Options:
    • Link

    Posted 22 March 2018, 3:59 pm EST

    Hi,

    just want to know is there any sample to use object like List as data source?

    I need get database without access database

  • Posted 26 March 2018, 8:37 pm EST

    Hi,

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

    Thanks,

    Pragati

    FlexReport.zip

  • Posted 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 datasource.in this sample, I would like to connect to SalesPersons

    if so , how can I get master-detail report useing List and object.List ?

  • Posted 1 April 2018, 7:57 pm EST

    Hi,

    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:

    http://help.grapecity.com/componentone/NetHelp/FlexReportUWP/webframe.html#C1.UWP.FlexReport~C1.Xaml.FlexReport.IC1FlexReportExternalRecordset.html

    A similar implementation sample for winforms installed at:

    …\Documents\ComponentOne Samples\WinForms\C1FlexReport\CS\ExternalDataSource

    Thanks,

    Singh

  • Posted 16 May 2018, 5:10 pm EST - Updated 30 September 2022, 12:11 am 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?

  • Posted 17 May 2018, 6:08 pm EST

    Hi,

    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.

    Thanks,

    Pragati

  • Posted 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.

  • Posted 20 May 2018, 3:53 pm EST

    Hi,

    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:

    http://prerelease.componentone.com/dotnet40/c1winforms/2018-T1/C1WinForms.4_4.0.20181.306.zip

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

    Thanks,

    Singh

  • Posted 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}

  • Posted 22 May 2018, 11:19 pm EST

    Hi,

    Please find the complete code below:

    Classes:

    
    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;
                subreportField.Subreport.Parameters.Clear();
                subreportField.Subreport.Parameters.Add(parameter);
                ReportParameterValue reportParameterValue = new ReportParameterValue();
                reportParameterValue.Name = "paramCategory"; //parameter name
                reportParameterValue.Value.Expression = "CategoryID"; //field of categories list for filter
                subreportField.ParameterValues.Add(reportParameterValue);
                subreportField.Subreport.DataSource.Filter = "CategoryID=[paramCategory]"; //filter
                c1FlexViewer1.DocumentSource = c1FlexReport1;
    

    Hope, it clarifies for you.

    Thanks,

  • Posted 23 May 2018, 10:56 am EST - Updated 30 September 2022, 12:11 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

    FlexTest1.zip

  • Posted 23 May 2018, 3:31 pm EST - Updated 30 September 2022, 12:11 am EST

    Hi,

    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;
                subreport1.Subreport.Parameters.Clear();
                subreport1.Subreport.Parameters.Add(paraId);
                ReportParameterValue paraIdValue = new ReportParameterValue();
                paraIdValue.Name = "spid"; //parameter name
                paraIdValue.Value.Expression = "id"; //field of categories list for filter
                subreport1.ParameterValues.Clear();
                subreport1.ParameterValues.Add(paraIdValue);
                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;
                subdetail.Subreport.Parameters.Clear();
                subdetail.Subreport.Parameters.Add(parasId);
                ReportParameterValue parasIdValue = new ReportParameterValue();
                parasIdValue.Name = "pSaleId"; //parameter name
                parasIdValue.Value.Expression = "id"; //field of categories list for filter
                subdetail.ParameterValues.Clear();
                subdetail.ParameterValues.Add(parasIdValue);
                dsdetail.Filter = "SaleId=[pSaleId]";
                subdetail.Subreport.DataSource.FilterSyntax = FilterExpressionSyntax.VBScript;
    

    Thanks,

    Singh

  • Posted 23 May 2018, 4:58 pm EST

    I tried your code, however I still get the same error after 3rd subreport as before?

  • Posted 24 May 2018, 9:19 pm EST

    Hi,

    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]

    Thanks,

    Singh

  • Posted 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?

    Regards,

  • Posted 3 June 2018, 8:05 pm EST

    Hi,

    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.

    Thanks.

  • Posted 9 July 2018, 6:28 pm EST

    Hi,

    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: http://prerelease.componentone.com/winrt/c1xaml/2018-t2/C1UWP_10.0.20182.595.zip

    Thanks,

    Ruchir

Need extra support?

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

Learn More

Forum Channels