Set subreport datasource from databand
- poweredbyporkers
- Posts: 28
- Joined: Fri Nov 29, 2013 8:42 pm
Set subreport datasource from databand
I seem to be talking to myself, but hopefully someone will eventually answer something....
I have a SQL statement that returns listing data and has a couple of the columns defined as XML fragments that contains many items, i.e. multiple cultures and translations. This is to remove the problem when I have 1 master row with 3 cultures and translations and 10 external codes. Normal SQL will return multiple rows of data obviously and it's really difficult maintain on the report. I have a routine that converts the XML fragment into a data table but I can't work out how to assign this data table at run time to the sub-report. I need to run this routine on each data row and assign the data source.
In Summary
Each data row that is output I need to get the Cultures column from the data source convert it into a datatable and assign that datatable as the datasource on the sub-report. I can't use relations
I have a SQL statement that returns listing data and has a couple of the columns defined as XML fragments that contains many items, i.e. multiple cultures and translations. This is to remove the problem when I have 1 master row with 3 cultures and translations and 10 external codes. Normal SQL will return multiple rows of data obviously and it's really difficult maintain on the report. I have a routine that converts the XML fragment into a data table but I can't work out how to assign this data table at run time to the sub-report. I need to run this routine on each data row and assign the data source.
In Summary
Each data row that is output I need to get the Cultures column from the data source convert it into a datatable and assign that datatable as the datasource on the sub-report. I can't use relations
- poweredbyporkers
- Posts: 28
- Joined: Fri Nov 29, 2013 8:42 pm
Re: Set subreport datasource from databand
Hello.
Here is a sample report template. You could find code in the Before Print event of the DataCategories band.
It's possible to change this code and load XML that you need for your report.
Thank you.
Here is a sample report template. You could find code in the Before Print event of the DataCategories band.
It's possible to change this code and load XML that you need for your report.
Thank you.
- Attachments
-
- Runtime dataTable creation.mrt
- (8.34 KiB) Downloaded 306 times
Re: Set subreport datasource from databand
How do I set sub report's data source if my current data source is coming from a business object and the sub report is present in an external file?
Re: Set subreport datasource from databand
Hello,
Could you explain your issue in more details?
Also, please clarify which product and version are you use?
Thank you.
Could you explain your issue in more details?
Also, please clarify which product and version are you use?
Thank you.
Re: Set subreport datasource from databand
Hi Alex,
I am using 2017.2. I have an external sub-report .mrt file. And a parent .mrt file.
My parent has data source from business object configured in the data sources section. Now when I try to add the sub-report, I can't find a way to pass the data source of the parent to the sub-report. Can I modify any events (before/after print) to pass the data?
Cheers
I am using 2017.2. I have an external sub-report .mrt file. And a parent .mrt file.
My parent has data source from business object configured in the data sources section. Now when I try to add the sub-report, I can't find a way to pass the data source of the parent to the sub-report. Can I modify any events (before/after print) to pass the data?
Cheers
Re: Set subreport datasource from databand
Hello,
You could handle the GetSubReport event and register you business objects there.
Thank you.
You could handle the GetSubReport event and register you business objects there.
Code: Select all
StiReport rep = new StiReport();
rep.LoadFromUrl(@"D:\MainReport.mrt");
rep.GetSubReport += new StiGetSubReportEventHandler(rep_GetSubReport);
rep.Render();
rep.Show();
.....
void rep_GetSubReport(object sender, StiGetSubReportEventArgs e)
{
StiReport rep = new StiReport();
rep.LoadFromUrl(@"D:\SubReport.mrt");
rep.RegData(ds);
e.Report = rep;
}
Re: Set subreport datasource from databand
Thanks, that works!
Re: Set subreport datasource from databand
Hello,
Thank you for letting us know about this.
Thank you for letting us know about this.