Page 1 of 1

Sub Report/Report Pack

Posted: Wed Nov 23, 2011 3:41 am
by Ink
Hi,

I have many single page reports which contain unrelated data from differnt sources. I would like to allow the user to combine them into one 'report pack', so that they may use the export functionality to produse a PDF file.
I know I can do this manually by creating seperate pages & data bands, but is there any way to embed existing reports inside another report? I have looked at the subreport function but am afraid I don't understand how to use it.

Regards,

Jon.

Sub Report/Report Pack

Posted: Thu Nov 24, 2011 1:39 am
by Alex K.
Hello,

For the Sub-Report component you can set the Page or another report. As a way, you can try to put several SubReport components on one page and set for it links on another reports.

Thank you.

Sub Report/Report Pack

Posted: Sat Nov 26, 2011 1:07 am
by Ink
Aleksey,

Thank you for the response. Could you please tell me how I do this? I can see the 'Use External Report' property, but cannot figure out how to set the report it uses.
Also, I will obviosuly need to do this in code at runtime. I will need to link each subreport to each main report and then set the datasource for each, as each main report has it's own Connection/Table.
Could you please give me a vb.net example of how to do this?

Many Thanks,

Jon.

Sub Report/Report Pack

Posted: Sat Nov 26, 2011 1:37 am
by Ink
Alesey,

Sorted it out. I use the following and it seems to work ok.

Dim ds As DataSet = New DataSet
Dim stiSub1 As New StiReport
Dim stiSub2 As New StiReport

Dim stiReportPack As New StiReport

With stiSub1
.Load(ReportPath & "\FirstReport.mrt")
.Dictionary.DataSources.Clear()
ds.ReadXmlSchema(ReportPath & "\FirstReport.xsd")
ds.ReadXml(ReportPath & "\FirstReport.xml")
.Dictionary.ImportXMLSchema(ds)
.RegData("Table", ds)
End With

With stiSub2
.Load(ReportPath & "\SecondReport.mrt")
.Dictionary.DataSources.Clear()
ds.ReadXmlSchema(ReportPath & "\SecondReport.xsd")
ds.ReadXml(ReportPath & "\SecondReport.xml")
.Dictionary.ImportXMLSchema(ds)
.RegData("Table", ds)
End With

With stiReportPack
.SubReports.Add(stiSub1)
.SubReports.Add(stiSub2)
.Render()
End With

Regards,

Jon.

Sub Report/Report Pack

Posted: Sun Nov 27, 2011 2:03 am
by Andrew
Hello,

Great!

Have a nice day!
Thank you.