Using external report as a subreport

Stimulsoft Reports.JS discussion
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 Lech, sorry for not clarifying what I want to achieve, I want to use the

Code: Select all

subReportUrl
like :

Code: Select all

report.subReportUrl = "/GetReport"
the GetReport is an MVC Controller Action:

Code: Select all

[HttpGet]
public async Task<JsonResult> GetReport()
{
     var  report = new StiReport();
    // here what to return ?
}
Lech Kulikowski
Posts: 7297
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

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,

As I mentioned earlier, I’m using the Stimulsoft.Js viewer, not the ASP.NET Core MVC version. What I need is guidance on how to set the report.subReportUrl property with the report data from the server (via an API or ASP.NET Core MVC controller action). The additional methods you provided are specific to the ASP.NET Core viewer.

Please let me know if this is unclear.

Best Regards,
Lech Kulikowski
Posts: 7297
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

How do you provide the report from the server-side on the client?

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,

here is my full code:

Code: Select all

<script type="text/javascript">
    StiOptions.WebServer.url = "/DataAdapters";
    Stimulsoft.Base.StiLicense.Key = "";

    $.ajax({
        url: `/ReportViewer/GetReport`,
        type: "Get",
        data: {
            Id: '1',
            ReportQuery: 'name=test'
        },
        contentType: "application/x-www-form-urlencoded",
        success: result => {
            if (result && result.length > 0) {
                var report = new Stimulsoft.Report.StiReport();
                report.load(result);

                var headerBand = report.getComponentByName("PageHeaderBand1");
                var headerReport = new Stimulsoft.Report.Components.StiSubReport();
                headerReport.subReportUrl = `/ReportViewer/GetSubReport?HeaderReportId=34&ReportQuery=`;
                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 options = new Stimulsoft.Viewer.StiViewerOptions();
                options.appearance.scrollbarsMode = true;
                options.toolbar.showPrintButton = true;
                options.toolbar.showSaveButton = true;
                options.toolbar.showAboutButton = false;
                options.toolbar.showBookmarksButton = false;
                options.toolbar.showParametersButton = false;
                options.toolbar.showResourcesButton = false;
                options.toolbar.showOpenButton = false;
                options.toolbar.showButtonCaptions = false;
               
                var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
                report.renderAsync(() => {
                    viewer.report = report;
                    viewer.renderHtml('sti-vv');
                });
            }
        }
    });
</script>
<div id="sti-vv"></div>
Lech Kulikowski
Posts: 7297
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

Please send us a sample project for analysis.

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 Lech,

please check the attached sample project.
Stimulosft.Demo.zip
(29 MiB) Downloaded 144 times
Lech Kulikowski
Posts: 7297
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

Unfortunately, in this case, it is not possible.

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 »

☹️🤦‍♂️
Lech Kulikowski
Posts: 7297
Joined: Tue Mar 20, 2018 5:34 am

Re: Using external report as a subreport

Post by Lech Kulikowski »

Hello,

Please let us know if you need any additional help.
Post Reply