Page 1 of 1

Combine XML and SQL Datasource in one Databand

Posted: Thu Dec 06, 2012 9:45 am
by Rayden
We have a report which is basically built from a XML File. According to a specific field A in a data record of this xml dataset i should load additional data from a table via SQL and display it in the same DataBand. I tried creating a DataSource to the SQL database and added SQL statement loading all entries matching field A.

But when i preview the report i get only the database data for the first record in the XML File which is then shown in every subsequent record. For every record the the sql query should be processed again with the current key i'm looping in the XML dataset.

Following a example of how it should look like in one record of the Databand:

DS_A = XML Datasource
DS_SQL = SQL Datasource
KEY_A = XML Key Field

DS_A.KEY, DS_A.Field1, DS_A.Field2, DS_A.Field3 .... DS_SQL.Field1, DS_SQL.Field2

where as DS_A.KEY should be used to get the appropriate DS_SQL data record.

Re: Combine XML and SQL Datasource in one Databand

Posted: Thu Dec 06, 2012 11:05 am
by HighAley
Hello.

You should create a relation between XML Datasource and SQL Datasource.
Set the Cache all Data property of the report to true to make it possible.

Thank you.

Re: Combine XML and SQL Datasource in one Databand

Posted: Fri Dec 07, 2012 7:31 am
by Rayden
Thank you for your fast answer, after some additional testing i found out i had the tables switched in the relation between the 2 datasources, it is working now.

Re: Combine XML and SQL Datasource in one Databand

Posted: Fri Dec 07, 2012 8:06 am
by HighAley
Hello.
Rayden wrote:Thank you for your fast answer, after some additional testing i found out i had the tables switched in the relation between the 2 datasources, it is working now.
We are always glad to help you.
Let us know if you need any additional help.

Thank you.

Re: Combine XML and SQL Datasource in one Databand

Posted: Fri Dec 07, 2012 10:06 am
by Rayden
I might have another issue but i fear i can't do anything as i can't touch the compiled code calling the report generator:

Code: Select all

      StiReport stiReport = new StiReport();
      stiReport.Load(str2);
      stiReport.RegData((DataTable) auftragDataTable);
      stiReport.Render(false);
I have access to the mrt file but i cant modify the compiled code above calling the report. So when i added the MSSQL datasource in the mrt file, it works like a charm in the report designer but when i execute this mrt inside the webapplication, i get the following error:

Code: Select all

InvalidOperationException: The ConnectionString property has not been initialized
Due to this thread http://forum.stimulsoft.com/viewtopic.php?&t=1914 i think the reason is the way the Report Engine is called. The RegData Command above only registers the XML Data, i mentioned above. If there is any way to load additional data into the report from a MSSQL database without touching the code above that would be great.

Re: Combine XML and SQL Datasource in one Databand

Posted: Fri Dec 07, 2012 11:47 am
by HighAley
Hello.

Please, try to call the stiReport.Dictionary.DataSources.Clear() method before RegData() method.

Thank you.

Re: Combine XML and SQL Datasource in one Databand

Posted: Mon Dec 10, 2012 10:38 am
by Rayden
Thanks again i was able to code the needed commands into the the mrt file, everything is working now as intended.

Re: Combine XML and SQL Datasource in one Databand

Posted: Tue Dec 11, 2012 7:10 am
by HighAley
Hello.

Let us know if you will need any additional help.

Thank you.