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.
Unfortunately, activation email could not send to your email. Please try again.

ReportDesigner refresh datasets

Thread ID:

Created:

Updated:

Platform:

Replies:

126070 Sep 21,2016 12:55 PM Sep 23,2016 02:17 AM WPF 3
loading
Tags: ReportDesigner
Stratos Geroulis
Asked On September 21, 2016 12:55 PM

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

Vijay Raja [Syncfusion]
Replied On September 22, 2016 09:23 AM

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 . 


Stratos Geroulis
Replied On September 22, 2016 10:24 AM

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

Thanks again!

Vinoth Srinivasan [Syncfusion]
Replied On September 23, 2016 02:17 AM

Hi Stratos, 

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

Regards, 
Vinoth S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;