Using external report as a subreport

Stimulsoft Reports.JS discussion
schindlergmbh
Posts: 7
Joined: Thu Mar 09, 2017 4:06 pm

Re: Using external report as a subreport

Post by schindlergmbh »

Hi,
unfortunately this event is not emitted on my report object.
Do you have a sample or a hint which conditions are necessary that this event is emitted?

Thank you.
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

Could you send us a sample which reproduces the issue for analysis?

Thank you.
schindlergmbh
Posts: 7
Joined: Thu Mar 09, 2017 4:06 pm

Re: Using external report as a subreport

Post by schindlergmbh »

Hi,

I found the issue. No it works. I worked on old Stimulsoft script files. --> Sorry.
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello

Ok.
Please let us know if you need any additional help.

Thank you.
User avatar
noob
Posts: 37
Joined: Sat Feb 05, 2022 9:03 am
Location: Iraq, Erbil

Re: Using external report as a subreport

Post by noob »

Hello,

im using Stimulsoft.Js 2024.3.3, and want to implement the subreport dynamically from code, here is my code:

Code: Select all

StiOptions.WebServer.url = "/DataAdapters";
Stimulsoft.Base.StiLicense.Key = '';

 var report = new Stimulsoft.Report.StiReport();
 report.load(resultJson);

report.onGetSubReport = function (e) {
    console.log('onGetSubReport', e);
};

var headerBand = report.getComponentByName("PageHeaderBand1");
var headerReport = new Stimulsoft.Report.Components.StiSubReport();
headerReport.clientRectangle = new Stimulsoft.Base.Drawing.RectangleD(0, 0, report.pages.getByIndex(0).width.value, headerBand.height.value);
headerReport.name = 'HeaderSubReport';
headerReport.componentStyle = "SubReport";
headerBand.components.add(headerReport);

var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
report.renderAsync(() => {
    viewer.report = report;
    viewer.renderHtml('sti-viewer');
});
my issue is the "onGetSubReport" never fires, what I'm doing wrong?
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

Try to use the report.subReports.add() method.

Thank you.
User avatar
noob
Posts: 37
Joined: Sat Feb 05, 2022 9:03 am
Location: Iraq, Erbil

Re: Using external report as a subreport

Post by noob »

Hello,

this method

Code: Select all

report.subReports.add()
adds the subReport to the second page!!!
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

Please check the following code:
var mreport = new Stimulsoft.Report.StiReport();
mreport.loadFile("../reports/mReport.mrt");

var subreport = mreport.getComponentByName("SubReport1");
subreport.subReportUrl = "../reports/subReport.mrt";

Thank you.
User avatar
noob
Posts: 37
Joined: Sat Feb 05, 2022 9:03 am
Location: Iraq, Erbil

Re: Using external report as a subreport

Post by noob »

Hi,

what to return from MVC Controller action for

Code: Select all

subreport.subReportUrl
?
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

Sorry, we did not exactly understand your question. Could you explain your issue in more detail?

Thank you.
Post Reply