Combine XML and SQL Datasource in one Databand
Combine XML and SQL Datasource in one Databand
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.
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
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.
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
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
Hello.
Let us know if you need any additional help.
Thank you.
We are always glad to help you.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.
Let us know if you need any additional help.
Thank you.
Re: Combine XML and SQL Datasource in one Databand
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:
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:
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.
Code: Select all
StiReport stiReport = new StiReport();
stiReport.Load(str2);
stiReport.RegData((DataTable) auftragDataTable);
stiReport.Render(false);
Code: Select all
InvalidOperationException: The ConnectionString property has not been initialized
Re: Combine XML and SQL Datasource in one Databand
Hello.
Please, try to call the stiReport.Dictionary.DataSources.Clear() method before RegData() method.
Thank you.
Please, try to call the stiReport.Dictionary.DataSources.Clear() method before RegData() method.
Thank you.
Re: Combine XML and SQL Datasource in one Databand
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
Hello.
Let us know if you will need any additional help.
Thank you.
Let us know if you will need any additional help.
Thank you.