Page 1 of 1
Rebuild DataSources with Dictionary.Synchronize()?
Posted: Thu Aug 13, 2009 4:20 am
by Andreas Tastler
I have a saved report bound to a DataSource with DataTables. I also added some calculated Columns to the DataSource (some are not used in the Report).
Someday the columns of the datatable are changing (new columns will be added, existing columns will be removed). The synchronize method of dictionary will only add new columns to the datasource, but deleted columns will not be removed. How can I reset the datasource to the datatable contents in datastore? I tried to clear the dictionary before synchronizing, but then all calculated columns are gone too

.
Thanks
Andreas
Rebuild DataSources with Dictionary.Synchronize()?
Posted: Thu Aug 13, 2009 9:31 pm
by Edward
Hi Andreas,
Please try to use the following command for each DataSource individually:
MyDataSource.SynchronizeColumns();
Thank you.
Rebuild DataSources with Dictionary.Synchronize()?
Posted: Wed Aug 19, 2009 12:25 am
by Andreas Tastler
Hi Edward
I tried to synchronize the way you suggested, but the result is the same. Columns that have been removed from the data tables will not be removed from dictionary.
Code: Select all
_stiReport.RegData("Report-Data", ReportDataSet);
_stiReport.RegData("Common-Data", CommonDataSet);
foreach (StiDataSource source in _stiReport.Dictionary.DataSources)
{
source.SynchronizeColumns();
}
I also tried the Method Dictionary.RemoveUnusedData but this also removes unused calculated columns. The calculated columns should not be removed.
Regards
Andreas
Rebuild DataSources with Dictionary.Synchronize()?
Posted: Wed Aug 19, 2009 7:54 pm
by Edward
Hi Andreas,
Please send a sample solution to support[at]stimulsoft.com for reproducing the issue, as I could not reproduce these wrong behaviour.
P.S. The following code can redraw the Dictionary panel if you called your code from designer:
Stimulsoft.Report.Design.Panels.StiDictionaryPanelService.GetService(this).DictionaryControl.Build((this).Report);
this - it is a designer.
Thank you.
Rebuild DataSources with Dictionary.Synchronize()?
Posted: Tue Aug 25, 2009 2:12 am
by Andreas Tastler
Hello Edward
I fixed it that way: before synchronizing the dictionary I remove all columns, which are not calculated, then I call the synchronize method. In this case all calculated fields are still available.
Regards
Andreas
Rebuild DataSources with Dictionary.Synchronize()?
Posted: Tue Aug 25, 2009 9:00 pm
by Edward
Hi Andreas,
Thank you for this information.