Page 1 of 4
Using external report as a subreport
Posted: Fri Jul 07, 2017 2:20 pm
by PaPy
Hi,
I want to use a header (maybe a Header.mrt file) for each reports of my customers. If I create 100 reports with this header I want that when I change my header.mrt all my reports with this header gets the header's modification.
I saw that you propose to use some components like "subReport". Have you got a sample project with some reports which use an external report as header for example ?
Re: Using external report as a subreport
Posted: Mon Jul 10, 2017 10:00 pm
by Alex K.
Hello,
You can use the following code to add SubReport to main report:
Code: Select all
var report1 = new Stimulsoft.Report.StiReport();
report1.loadFile("\mainReport.mrt");
var report2 = new Stimulsoft.Report.StiReport();
report2.loadFile("\subReport.mrt");
report1.subReports.add(report2);
Thank you.
Re: Using external report as a subreport
Posted: Tue Jul 11, 2017 8:08 am
by PaPy
Hi Aleksey, thanks for your answer.
When I try your code I see my subReport as a second report (on the second page of my main report) only in my viewer. (I can't edit this subReport using designer)
I don't want to add a subReport as a second page of my report. I want to add a report in a part of my main report.
For example I want something like this (see image in attachment).
In our first app we used ReportBuilder. We created report with a custom footer and header for a company. When a logo for a company change for any reason, the company have to change just one file which contains the Header and all the files with this Header get the new logo. In this way, the company do not have to open and change all them reports, they change only one file and all the reports's header get an update. I want to do the same thing with Stimulsoft for our App 2.0.
We just paid your app, I can't use the function "search" in your documentation (
https://admin.stimulsoft.com/documentat ... lsoft.html) so it's pretty hard to find how I can do it and I'm loosing a lot of time when I wait an answer through this forum...
So please, tell me if you do not understand what I want to do, I will try to be clearer to be more understandable, I really need to do it quickly.
Thanks in advance.
Re: Using external report as a subreport
Posted: Wed Jul 12, 2017 7:08 am
by PaPy
Up ?
Re: Using external report as a subreport
Posted: Thu Jul 13, 2017 8:49 pm
by Alex K.
Hello,
In this case, you can use additional SubReports for header and footer or add necessary components from code:
https://www.stimulsoft.com/en/samples/j ... -from-code
Thank you.
Re: Using external report as a subreport
Posted: Wed Jan 03, 2018 1:16 pm
by schindlergmbh
Hi,
I have the same issue.
I have my subreport from a different template (report as xml template string in my case). How can I show this sub template in the subreport component?
Acctually i uses tis code:
report1.subReports.add(report2);
but it is shown as a second page. Not in my subreport component.
Re: Using external report as a subreport
Posted: Thu Jan 04, 2018 8:16 am
by HighAley
Hello.
There is another solution for you.
You could set the MasterReport for each your report.
The maser report should contain the Header and the Footer.
You could read more in
the Report Inheritance > Basic Approaches section of the Programming Manual.
If you want to use external subreport, you should set the subreport in the GetSubReport event.
Code: Select all
void rep_GetSubReport(object sender, StiGetSubReportEventArgs e)
{
StiReport rep = new StiReport();
rep.LoadFromUrl(@"D:\SubReport.mrt");
rep.RegData(ds);
e.Report = rep;
}
Thank you.
Re: Using external report as a subreport
Posted: Fri Feb 09, 2018 3:11 pm
by schindlergmbh
Hi HighAley,
is there such an event (GetSubReport) in JS?
I can't find it in the Report.JS docs.
Thank you.
Re: Using external report as a subreport
Posted: Sat Feb 10, 2018 2:42 pm
by HighAley
Hello,
Unfortunately, there is no such event in Reports.JS.
We need to check if it's possible to add this event.
Thank you.
Ticket reference: #5799
Re: Using external report as a subreport
Posted: Thu Feb 22, 2018 9:35 am
by HighAley
Hello.
We have added the GetSubReport event.
Here is a sample:
Code: Select all
report.onGetSubReport = function (e) {
e.report = new StiReport(); //SubReport
};
Thank you.