How to load the subreport?

Stimulsoft Reports.WEB discussion
Post Reply
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

How to load the subreport?

Post by jpascual »

Hello,
I have a report that contains a subreport, I do not know how to load the subreport I tested with this ruling but says there is no subreport:

report.RegData(DSSubReport)

I have also tried this:
report.Dictionary.DataSources(1).GetDataTable(DsContenidoMenu.Tables(0))

This is the code that by the report:
Dim DSvis As New DataSet
DSvis.Tables.Add(DSReport.Ttables(0).Copy())
Dim report As New StiReport
report.Load(savePath) <- file *.mrt
report.RegData(DSvis)
******IN THIS LINE TRIED TO LOAD SUBREPORT*******
StiWebViewerFx1.Report = report
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

How to load the subreport?

Post by Andrew »

Hello,

Subreports can be internal and external. If subreports are internal, then they are placed on the nested pages of a main report. If subreports are external, then they are requested with the reporting tool by the GetSubReport event.
Can you, please clarify how do you use subreports, as external or internal?

Thank you.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

How to load the subreport?

Post by jpascual »

hi,

The subreport is internal, is integrated into a main report.

thanks for you help
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

How to load the subreport?

Post by Andrew »

Hello,

For loading an external subreport you may use the following code sample:

.....
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");
e.Report = rep;
}

Thank you.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

How to load the subreport?

Post by jpascual »

Hi, thanks for your answer, but the subreport is internal not external. I do not know how to send the dataset to load the subreport.
My report looks like this:
http://web.stimulsoft.com/?reportname=S ... SubReports
It contains a subreport and I have two dataset, one for the report and another for the subreport, but I do not know how to assign the subreport's dataset.
Since the dataset of the report was assigned to the method "Regdata (DsInforme)"
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

How to load the subreport?

Post by jpascual »

I've gotten it to work, was to create a relationship between two fields of each of the datasets in this way if he showed data report.
Thanks for your help.
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

How to load the subreport?

Post by Andrew »

Thank you for letting us know.
Post Reply