Page 1 of 2
Using external report as a subreport.
Posted: Fri Aug 03, 2007 8:36 am
by Pilgrim
Good day.
I want to know if it is possible to use an external report (e.g. a one page report that displays a clients details) as a subreport in another report.
What I want to do is have a report list all the clients then for each client load the external report that displays the details.
That way we can reuse the client details report on other reports.
(generic example, we want to create hundreds of little reports that we can use on a few big reports and perhaps use those big reports in a huge month end report)
Thank you :biggrin:
Using external report as a subreport.
Posted: Sun Aug 05, 2007 6:16 am
by Vital
Hello!
You can try use property SubReports of StiReport. Please see attached sample project.
Thank you.
Using external report as a subreport.
Posted: Mon Aug 06, 2007 2:03 am
by Pilgrim
That is really awesome.
Now I just have one more question.
Is there a way to use a data list to load sub reports?
I want to create a sub report that displays details depending on a "parameter" and a data list that generates that "parameter"
I want to list all the products bought by a client and pass the product code for each product to the product details reports.
Then I want to create a report that creates this report for all our active clients.
But what is really important is that I want to use external reports for each step. I may want to use the product details on its own, or run a single client report.
I really look forward to your reply.
Thanks.
Using external report as a subreport.
Posted: Tue Aug 07, 2007 9:15 am
by Guest
We will add this possibility on 9 August.
Thank you.
Using external report as a subreport.
Posted: Fri Aug 10, 2007 3:28 am
by Vital
You can check build from 10 August. Set new property UseExternalReport to true. property SubReportPage to null. After then you need add event handler to event GetSubReport of StiReport object:
Code: Select all
private void OnGetSubReport(object sender, StiGetSubReportEventArgs e)
{
StiReport report = new StiReport();
report.Load("d:\\SimpleGroup.mrt");
DataSet data = new DataSet();
data.ReadXml("d:\\demo.xml");
data.ReadXmlSchema("d:\\demo.xsd");
report.RegData("Demo", data);
e.Report = report;
}
report.GetSubReport += new StiGetSubReportEventHandler(OnGetSubReport);
Also you need detect current line of specified datasource. You can use following code in event handler:
Code: Select all
StiReport parentReport = sender as StiReport;
StiDataSource data = parentReport.Dictionary.DataSources["MyDataSource"];
object value = data["MyColumn"];
Received value you can use as variable in subreport.
Thank you.
Using external report as a subreport.
Posted: Fri Aug 10, 2007 3:34 am
by Pilgrim
Thank you very much!
I will implement it this weekend :grinder:
Using external report as a subreport.
Posted: Fri Aug 10, 2007 7:03 am
by Guest
If you will have any problems, please, inform us, because this option is a new.
Thank you.
Using external report as a subreport.
Posted: Wed Aug 15, 2007 5:01 am
by Pilgrim
Hi Pavel.
I cannot get the external subreports to work. :dumb:
Can you perhaps send me a sample project?
Thanks.
Using external report as a subreport.
Posted: Thu Aug 23, 2007 5:37 am
by Edward
The problem is fixed. Fix will be available in the build from August, 23.
Thank you.
Using external report as a subreport.
Posted: Thu Apr 03, 2008 3:37 am
by Pilgrim
Hi Guys.
I updated to the newest version of Stimulsoft and now subreporting does not work any more.
Code: Select all
Dim parentReport As Stimulsoft.Report.StiReport = TryCast(sender, Stimulsoft.Report.StiReport)
If parentReport Is Nothing Then
Exit Sub
End If
Dim comp As Stimulsoft.Report.Components.StiComponent = parentReport.GetComponentByName(e.SubReportName)
If comp Is Nothing Then
Exit Sub
End If
Dim dataBand As Stimulsoft.Report.Components.StiDataBand = comp.GetDataBand()
If dataBand Is Nothing Then
'This subreport is not on an databand. Just display it.
Else
'Databand found.
Dim data As Stimulsoft.Report.Dictionary.StiDataSource
data = parentReport.Dictionary.DataSources(dataBand.DataSourceName)
If data Is Nothing Then
Exit Sub
End If
Dim value As Object = data("CODE")
If value Is Nothing Then
Exit Sub
End If
Debug.WriteLine(data.Position & " ->" & value.ToString)
End If
The data.position stays at 0. Any idea what is going on?
Thanks.