Page 1 of 2

Update datasource via application

Posted: Sat Jun 27, 2015 11:05 am
by Hessam8008
Hi,
I've created a report which is included an SQL data source.
Then, two other data sources created from "Data from other data source" which is derived from the first data source.
I use below code to feed my report via my application :

Code: Select all

With ReportDocumnet
                    .Load(<MyReportPath>)
                    .Compile()
                    .Dictionary.Clear()
                    .RegData(<myDataTable>)
                    .Dictionary.Synchronize()
                    .Render()
With
When I want to see result, NullRefrenceException throw! I think because of .Dictionary.Clear(), clear all data sources and after that I only create one data source ( .RegData(<myDataTable>) ) and my report miss two other data sources. How should I feed my report correctly ?

Re: Update datasource via application

Posted: Mon Jun 29, 2015 6:22 am
by HighAley
Hello.

Could you describe your issue more detailed?
You write that you use SQL data source with Data from Other Data Source but in code you register a table.
What table do you register?
How do you use SQL Data Source?
What version do you use?

Thank you.

Re: Update datasource via application

Posted: Wed Jul 01, 2015 4:26 pm
by Hessam8008
Hi,
I only load a data table from SQL into stiReport. On the other hand I need to display different charts, so, I use 'Data from Other Data Source' which is based on previous data table to create summarized structure.
Problem is when I pass the data table to stiReport via my application: No changes in charts!! :?:
I have attached my sample report.
Version : 2014.3.0

Re: Update datasource via application

Posted: Thu Jul 02, 2015 6:36 am
by HighAley
Hello.

Please, try to add next methods before registering the table:

Code: Select all

.Dictionary.Databases.Clear();
.Dictionary.DataSources.Clear();
Thank you.

Re: Update datasource via application

Posted: Thu Jul 02, 2015 2:50 pm
by Hessam8008
Hello,
Unfortunately it doesn't work and throw an error : The name 'GroupByDay' does not exist in the current context.
By the way, if I eliminate parts of my report that use 'GroupByDay', then, those codes work properly!!!

Thank you.

Re: Update datasource via application

Posted: Fri Jul 03, 2015 10:00 am
by Ivan
Hello,
I only load a data table from SQL into stiReport.
But your report is already contain a SQL datasource "rpt_TimeAndDay".
Please try to do the following: in designer delete the "rpt_TimeAndDay" datasource from dictionary, then use the following code:

Code: Select all

With ReportDocument
                    .Load(<MyReportPath>)
                    .RegData("rpt_TimeAndDay", <myDataTable>)
                    .Dictionary.Synchronize()
                    .Compile()
                    .Render()
With
Thank you.

Re: Update datasource via application

Posted: Sat Jul 04, 2015 9:01 am
by Hessam8008
Hello,
Ivan wrote: Please try to do the following: in designer delete the "rpt_TimeAndDay" datasource from dictionary...
It dose NOT work and generate errors!!!
"rpt_TimeAndDay" is the only data table that I pass to stiReport. Other sources in stiReport use that data table.

Thank you.

Re: Update datasource via application

Posted: Mon Jul 06, 2015 6:48 am
by Alex K.
Hello,

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

Thank you.

Re: Update datasource via application

Posted: Tue Jul 07, 2015 8:19 am
by Hessam8008
Hello,

I have attached my sample project.

Thank you.

Re: Update datasource via application

Posted: Tue Jul 07, 2015 11:52 am
by HighAley
Hello.

You have connection and data source in the report. Why do you register it again.
If the connection is right, report engine will take all necessary data.
It's better to write SQL queries instead of using Data Source from Other Data Source. This scenario will work much faster on large data.

Thank you.