We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

ReportDesigner refresh datasets

Hello,
I have a report template made programmatically which has my data source (odbc excel file) and data sets. On the data sets I have a query to select all the columns from the sheet. I don't have any fields populated when I make the report template (.rdl) but I want it to programmatically trigger the refresh to bring all the fields in automatically. The data sets show up on the tool bar on the right but they are empty (as expected, the template has no fields) but if I do "data set properties" and I just change the name, the designer automatically triggers a refresh and brings in all the fields. Is this possible to be done automatically right after I do "ReportDesignerControl.OpenReport(report)"?
Thank you,
Stratos

3 Replies

VR Vijay Raja Syncfusion Team September 22, 2016 01:23 PM UTC

Hi Stratos, 

We don’t have option to programmatically refresh the fields in a dataset and we are programmatically creating connection using the connectionstring available in dataset and adding the column names as fields to the datasets. You can create the database connection in your sample during the report creation and resultant column names need to be added to the respective dataset fields collection to display at initial load of the report. The fields can be added to the report collection as shown in the below code sample.  

private Syncfusion.RDL.DOM.ReportDefinition EditDataSet(object dataTable, Syncfusion.RDL.DOM.ReportDefinition reportDefinition) 
  { 
     foreach(Syncfusion.RDL.DOM.DataSet dataset in reportDefinition.DataSets) 
     { 
        dataset.Fields = new Syncfusion.RDL.DOM.Fields(); 
 
        foreach (DataColumn column in (dataTable as DataTable).Columns) 
        { 
            Field field = new Field() 
            { 
               Name = column.ColumnName, 
               DataField = column.ColumnName, 
               TypeName = column.DataType.ToString() 
             }; 
 
             dataset.Fields.Add(field); 
         } 
     } 
 
    return reportDefinition; 
 } 

Please refer to the below online knowledge base to know more about editing report element programmatically. 

Please let us know if have any queries. 

Regards, 
Vijay R . 



SG Stratos Geroulis September 22, 2016 02:24 PM UTC

OK thank you, I added all the fields to the report template before opening.

Thanks again!


VS Vinoth Srinivasan Syncfusion Team September 23, 2016 06:17 AM UTC

Hi Stratos, 

Thanks for your update. Please let us know if you need any other assistance. 

Regards, 
Vinoth S. 


Loader.
Live Chat Icon For mobile
Up arrow icon