Multiple Report sharing a common base (master, template)

Stimulsoft Reports.JS discussion
Post Reply
audiomedia
Posts: 7
Joined: Wed Jan 10, 2024 7:44 am

Multiple Report sharing a common base (master, template)

Post by audiomedia »

Hi
I have to make multiple reports, most of them having in common the same header, footer part, address field for the postmail, and so on.
I don't find a way of having a master report, a template report, i don't know how to call it, so that I can change for example the header in 1 place and not edit 20 reports.

Maybe I issed it, thanks in advance if a good solution exist.
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Multiple Report sharing a common base (master, template)

Post by Lech Kulikowski »

Hello,

You can add your reports as templates in the designer with the following code:

Code: Select all

var designer = new Stimulsoft.Designer.StiDesigner(options, designerId, false);
designer.renderHtml("content");
var newReportPanel = designer.jsObject.options.newReportPanel || designer.jsObject.InitializeNewReportPanel();
var customBigButton = designer.jsObject.NewReportPanelButton("customReportButton", "My Report Button", "BlankReport.png");
//If you want change button image
//customBigButton.image.src = "https://www.google.by/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
newReportPanel.childNodes[1].addCell(customBigButton);
customBigButton.action = function () {
    var fileMenu = this.jsObject.options.menus.fileMenu || this.jsObject.InitializeFileMenu();
    fileMenu.changeVisibleState(false);
    setTimeout(function () {
        //Write your code here
        alert("customReportButton was clicked!");
    }, 200);
}
Thank you.
audiomedia
Posts: 7
Joined: Wed Jan 10, 2024 7:44 am

Re: Multiple Report sharing a common base (master, template)

Post by audiomedia »

I'm not sure I undertand what you are saying, but what I would like to have is like a Master report that I can update et it would update all the child reports that use the master reports.
How do you proceed if you make a lot of reports for a company and this company changes the logo, the design of the Header and Footer of reports ? Do you have to update every single reports ?
I see I can make SubReports that I can include in a other report. But I have to test if it is ok for my needs.

And I'm not talking about the design client side, they don't have access, I do the design, they only use the viewer and make PDF, print, so on.
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Multiple Report sharing a common base (master, template)

Post by Lech Kulikowski »

Hello,

Yes, in this case, you can use the SubReport component for this task.

Thank you.
audiomedia
Posts: 7
Joined: Wed Jan 10, 2024 7:44 am

Re: Multiple Report sharing a common base (master, template)

Post by audiomedia »

I have 2 problems in using SubReports in an other report.
1. the file or URL is fixed, how to be able to change the or file patch. I use php / JS viewer
2. It works on a multiple page report on page 2 and next, but not in first page, on the JS viewer, but it is shown on the the preview from the App Designer on the computer. I checked Print On : All Pages, Enable is true... so on

Any help ?
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Multiple Report sharing a common base (master, template)

Post by Lech Kulikowski »

Hello,

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

Thank you.
audiomedia
Posts: 7
Joined: Wed Jan 10, 2024 7:44 am

Re: Multiple Report sharing a common base (master, template)

Post by audiomedia »

First of all, I use the PHP version, that means I have the JS version too. But i do all I can on the php side.

I have 2 problems with subreport.
1. for a subreport, we have to give it a source, the URL, or FILE path to the report. It seams I cannot use a relative path, and I don't have exactly the same path on a dev server than the prod server. How you do it ? Should I update it by JS? if yes, how ? I don't get the logic here. It is even worst online, on the cloud designer, i f I want to try that, I don't see how to get the subReport from an existing report, no way to get it's URL.

2. I have a strange behavior on the subreport. I use it in a main report, my subreport is the header and is not shown on the first page, but on the other pages. But I have no settings saying so. I checked all the settings like print on all pages, and so on, they are all ok.. But the Header is empty on first page and is there everywhere else... Why is that ? I can send you the test per email if needed.

Thanks
audiomedia
Posts: 7
Joined: Wed Jan 10, 2024 7:44 am

Re: Multiple Report sharing a common base (master, template)

Post by audiomedia »

I have an update:
I still have the question about the URL, but Now it work with a relative url... not befoire.
But about the 2nd problem, I see that it seems the report is keeping settings that I don't want. An image is supposed to be shown with a parameter in the dataset, i had an expression on the "Enable" setting. But even if I arese the expression and I put True or False, it keeps the same behavior ! Somwhow the report has some cache ? Any idea ?
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Multiple Report sharing a common base (master, template)

Post by Lech Kulikowski »

Hello,

Please send us a sample that reproduces the issue for analysis.

Thank you.
Post Reply