Refresh fields in datasource

Stimulsoft Reports.Net discussion
dlangford
Posts: 1
Joined: Wed Aug 06, 2014 1:22 am

Refresh fields in datasource

Post by dlangford » Wed Aug 06, 2014 1:29 am

Hi,

We're just evaluating your product, but can't figure out how to achieve this...

I have a report that is linked to a sql view, and want to add a field to the view then have it available in the report designer.

After adding a field to a view used in a report, I've tried opening the report, going to the Dictionary panel, then going Actions -> Syncronize...but the new field doesn't appear.

Hopefully there's a simple way for the designer to see the database changes...

Thanks in advance,
Dave.
Alex K.
Posts: 6489
Joined: Thu Jul 29, 2010 2:37 am

Re: Refresh fields in datasource

Post by Alex K. » Wed Aug 06, 2014 6:53 am

Hello, Dave

Please try to use the "RetrieveColumn" button in the edit datasource window for the necessary datasource.

Thank you.
petrdivis
Posts: 18
Joined: Thu Mar 23, 2017 7:05 am

Re: Refresh fields in datasource

Post by petrdivis » Tue Jul 09, 2019 11:18 am

Hi,
can this be achieved programatically when having custom StiUserSource and StiUserAdapterService? So the column appears in Dictionary on the right

thanks!
Lech Kulikowski
Posts: 1863
Joined: Tue Mar 20, 2018 5:34 am

Re: Refresh fields in datasource

Post by Lech Kulikowski » Thu Jul 11, 2019 9:20 pm

Hello,

You can use RegData() and Synchronize() methods.

Thank you.
petrdivis
Posts: 18
Joined: Thu Mar 23, 2017 7:05 am

Re: Refresh fields in datasource

Post by petrdivis » Mon Jul 15, 2019 1:37 pm

Hello,
unfortunatelly, the RegData creates a new DataSource "test" instead of replacing our "GEONIS/test" datasource
GeonisReportDesigner_2019-07-15_15-34-53.png
GeonisReportDesigner_2019-07-15_15-34-53.png (4.29 KiB) Viewed 291 times
the code:

Code: Select all

StiReport.Load(filePath);
UpdateAssemblies();

foreach (StiDataSource stiReportDataSource in StiReport.DataSources)
{
    if (stiReportDataSource.GetDataAdapter() is GReportAdapterService gds)
    {
        DataTable gDataTable = gds.FetchColumns(stiReportDataSource as GReportDataSource);
        StiReport.RegData(stiReportDataSource.Name, gDataTable);
    }
}

StiReport.Dictionary.Synchronize();
Lech Kulikowski
Posts: 1863
Joined: Tue Mar 20, 2018 5:34 am

Re: Refresh fields in datasource

Post by Lech Kulikowski » Mon Jul 15, 2019 8:48 pm

Hello,

You should use the same name of the DataSet(GEONIS) and Table(test) in the RegData() method.

Thank you.
petrdivis
Posts: 18
Joined: Thu Mar 23, 2017 7:05 am

Re: Refresh fields in datasource

Post by petrdivis » Tue Jul 16, 2019 6:17 am

Thanks, I tried as you suggested with
RegData("GEONIS", gDataTable) but it didnt refresh missing column.

the mrt looks like this:
Notepad2_2019-07-16_08-04-30.png
Notepad2_2019-07-16_08-04-30.png (51.2 KiB) Viewed 281 times
I tried to delete DOCUMENT column from the DB, but in Dictionaries in Designer it does not refresh.
GeonisReportDesigner_2019-07-16_08-08-27.png
GeonisReportDesigner_2019-07-16_08-08-27.png (15.01 KiB) Viewed 281 times
The "GEONIS" is category name in the GReportDataSource.

Code: Select all

public override string GetCategoryName()
{
    return "GEONIS";
}
Attachments
GeonisReportDesigner_2019-07-16_08-08-27.png
GeonisReportDesigner_2019-07-16_08-08-27.png (15.01 KiB) Viewed 281 times
Lech Kulikowski
Posts: 1863
Joined: Tue Mar 20, 2018 5:34 am

Re: Refresh fields in datasource

Post by Lech Kulikowski » Tue Jul 16, 2019 7:34 am

Hello,

Please check:
report.Dictionary.DataSources.Clear();
report.RegData("");
report.Dictionary.Synchronize();

Thank you.
petrdivis
Posts: 18
Joined: Thu Mar 23, 2017 7:05 am

Re: Refresh fields in datasource

Post by petrdivis » Tue Jul 16, 2019 8:55 am

That is weird, even if i do
report.Dictionary.DataSources.Clear();
report.Dictionary.Synchronize();

the Data Sources in Dictionary UI does not get empty.
Lech Kulikowski
Posts: 1863
Joined: Tue Mar 20, 2018 5:34 am

Re: Refresh fields in datasource

Post by Lech Kulikowski » Tue Jul 16, 2019 1:38 pm

Hello,

Please send us a sample project which reproduces the issue for analysis.

Thank you.
Post Reply