Report Merging

Stimulsoft Reports.JS discussion
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Report Merging

Post by BCS »

BCS wrote: Tue Sep 25, 2018 10:05 pm Is it possible to update the previous example with this concept, I'm still having trouble with it.
Lech Kulikowski wrote: Thu Sep 27, 2018 6:38 am Hello

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

Thank you.
Sir you skipped my original question in reply to your answer about renumbering pages...
Lech Kulikowski
Posts: 6239
Joined: Tue Mar 20, 2018 5:34 am

Re: Report Merging

Post by Lech Kulikowski »

Hello,

Something like:

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.dictionary.variables.getByName("var1").valueObject = 1;
report1.renderAsync(function () {
    for (var index = 0; index < report1.renderedPages.count; ++index) {
        reportMerge.renderedPages.add(report1.renderedPages.getByIndex(index));
    }
});

report2.dictionary.variables.getByName("var1").valueObject = report1.renderedPages.count;
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");[code]
Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Report Merging

Post by BCS »

I have tried several ways to implement your suggestion but it doesn't seem to be changing the report variable, its always a 1. Is it possible to attach a small set of example files with the Javascript code and 2 simple report files? Perhaps if I can see a full example it will make sense.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Report Merging

Post by BCS »

Is it not just possible upon fully rendering to use something like this:

https://admin.stimulsoft.com/documentat ... agenumbers

I'm not sure how to use that if it is a possible solution for renumbering the page numbers on merged reports
Lech Kulikowski
Posts: 6239
Joined: Tue Mar 20, 2018 5:34 am

Re: Report Merging

Post by Lech Kulikowski »

Hello,

Need some time to prepare a sample.

Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Report Merging

Post by BCS »

Okay, much appreciated.
Lech Kulikowski
Posts: 6239
Joined: Tue Mar 20, 2018 5:34 am

Re: Report Merging

Post by Lech Kulikowski »

Hello

Ok, we will reply in this topic when will have the sample for you.

Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Report Merging

Post by BCS »

I am getting close to needing this piece quickly.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Report Merging

Post by BCS »

Since this has taken nearly 2 weeks to get any type of real example on page renumbering I thought I'd share my approach. I was forced to examine this problem for hours due to upcoming deadline. Can I get confirmation that this is an acceptable solution as well?

After rendering each report into a merged report, make sure all reports you are merging have a text component named "PageNumbers" and use the following:

Code: Select all

            reportMerge.renderedPages.list.forEach(function(page,i,arr) {
                var component = page.components.getByName('PageNumbers')

                if(component)
                    component.text = 'Page ' + (i + 1) + ' of ' + reportMerge.renderedPages.count
            });
Lech Kulikowski
Posts: 6239
Joined: Tue Mar 20, 2018 5:34 am

Re: Report Merging

Post by Lech Kulikowski »

Hello,

Thank you for the provided solution. Yes, this solution right.
Post Reply