Pre-filling information for Designer

Posted by: mdynna on 9 December 2021, 8:53 am EST

  • Posted 9 December 2021, 8:53 am EST

    Hi there,

    We are starting to experiment with implementing the Activereports Designer for our clients to use. In doing this we would really like to prefill a bunch of “setup” information to get our client started when making a report. I have figured out how to create a DataSource and DataSet at run-time and pass them to the report begin edited in the Designer. The last piece I need is to pre-fill the Fieldscollection so they are all available on the report. I’ve done a bunch of searching through the documentation and can’t seem to find the object or function to fill that collection?

    I did see some examples of using a DataAdapter.Fill method to do this, but that requires declaring another set of connection and command objects which seems redundant since I already have DataSource, DataSet, and Query objects for the PageReport.j

  • Posted 14 December 2021, 8:05 pm EST

    Please use the Fields collection of DataSet:

    
    GrapeCity.ActiveReports.PageReportModel.DataSet myDataSet = new GrapeCity.ActiveReports.PageReportModel.DataSet();
    
    GrapeCity.ActiveReports.PageReportModel.Field _field = new
    GrapeCity.ActiveReports.PageReportModel.Field("ProductID", "ProductID", null);
    myDataSet.Fields.Add(_field);
    
    
  • Posted 15 December 2021, 4:59 am EST

    Is there a way to loop through all the names of the columns returned by the query and fill the Fields collection using that? I don’t want to have to hard code the field names.

  • Posted 16 December 2021, 5:34 am EST

    Unfortunately, the Fields collection doesn’t get populated on its own if the dataset is added at runtime. You’ll have to query the datasource using a DataAdapter and add the fields based on the columns returned.

Need extra support?

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

Learn More

Forum Channels