Page 1 of 3
Report Merging
Posted: Wed Sep 19, 2018 6:27 am
by BCS
Is it possible to merge or append different reports together as in different (*.mrt) files. I know one can make different pages in one report but the scope of my requirements require me to obtain external documents or agreements or other analytics reports which I can template but each end product will be different and may or may not use all pages.
My guess was probably to gain access to the page collection before rendering but I'm at a lose how to proceed from there if its even possible.
I am using Stimulsoft Reports.JS
Re: Report Merging
Posted: Fri Sep 21, 2018 2:41 pm
by Lech Kulikowski
Hello,
You can use the following code:
Code: Select all
var report1 = new Stimulsoft.Report.StiReport();
report1.loadFile("Reports/1.mrt");
var report2 = new Stimulsoft.Report.StiReport();
report2.loadFile("Reports/2.mrt");
var reportMerge = new Stimulsoft.Report.StiReport();
reportMerge.reportUnit = report1.reportUnit;
reportMerge.render();
reportMerge.renderedPages.clear();
report1.renderAsync(function () {
for (var index = 0; index < report1.renderedPages.count; ++index) {
reportMerge.renderedPages.add(report1.renderedPages.getByIndex(index));
}
});
report2.renderAsync(function () {
for (var index = 0; index < report2.renderedPages.count; ++index) {
reportMerge.renderedPages.add(report2.renderedPages.getByIndex(index));
}
});
viewer.report = reportMerge;
viewer.renderHtml("viewerCont");
Thank you.
Re: Report Merging
Posted: Fri Sep 21, 2018 3:52 pm
by BCS
Okay thank you I will give it a try and let you know.
Re: Report Merging
Posted: Fri Sep 21, 2018 7:15 pm
by Lech Kulikowski
Hello
We are always glad to help you!
Please let us know if you need any additional help.
Thank you.
Re: Report Merging
Posted: Sat Sep 22, 2018 6:52 am
by BCS
I do have an additional question, how does one reset the page numbering so that the page numbering is contiguous and not 1 of 4 then for the next report 1 of 7 for instance instead of 1 of 11?
Re: Report Merging
Posted: Mon Sep 24, 2018 7:45 am
by Lech Kulikowski
Hello,
You can try to use an additional variable for page numbering. After first report rendering set the count of pages to that variable and provide it in the second report.
Thank you.
Re: Report Merging
Posted: Tue Sep 25, 2018 10:05 pm
by BCS
Is it possible to update the previous example with this concept, I'm still having trouble with it.
Re: Report Merging
Posted: Wed Sep 26, 2018 5:10 am
by BCS
I am also having an issue where sometimes it will not render the report with renderAsync, i have to refresh the page to make it work properly. Is there a way to know when the report is done rendering?
Re: Report Merging
Posted: Thu Sep 27, 2018 4:51 am
by BCS
BCS wrote: ↑Wed Sep 26, 2018 5:10 am
I am also having an issue where sometimes it will not render the report with renderAsync, i have to refresh the page to make it work properly. Is there a way to know when the report is done rendering?
I think I solved this issue by making each report be "reportX.isAsych = true"
Re: Report Merging
Posted: Thu Sep 27, 2018 6:38 am
by Lech Kulikowski
Hello
Ok.
Please let us know if you need any additional help.
Thank you.