Page 1 of 1

Reference External Report

Posted: Wed May 25, 2011 8:30 pm
by timber0000
Is it possible to reference an external report and pull it into another report as a subreport? We are having difficulty using multiple databases in the same report and wondered if we could create the subreports as standalone reports that function entirely on their own and them import and merge them into one report. If this is possible, where would I find the necessary documentation to guide me thru the process?

Thank You,

Kent Swinson

Reference External Report

Posted: Thu May 26, 2011 4:23 am
by Ivan
Hello,

You can use the following code, for example:

Code: Select all

            StiReport rep1 = new StiReport();
            rep1.Load("report1.mrt");
            StiReport rep2 = new StiReport();
            rep2.Load("report2.mrt");
            StiReport rep3 = new StiReport();
            rep3.Load("report3.mrt");

            StiReport mainreport = new StiReport();
            mainreport.SubReports.Add(rep1);
            mainreport.SubReports.Add(rep2);
            mainreport.SubReports.Add(rep3);
            mainreport.Render();
            mainreport.Show();
Thank you.

Reference External Report

Posted: Thu May 26, 2011 12:55 pm
by timber0000
Ivan wrote:Hello,

You can use the following code, for example:

Code: Select all

            StiReport rep1 = new StiReport();
            rep1.Load("report1.mrt");
            StiReport rep2 = new StiReport();
            rep2.Load("report2.mrt");
            StiReport rep3 = new StiReport();
            rep3.Load("report3.mrt");

            StiReport mainreport = new StiReport();
            mainreport.SubReports.Add(rep1);
            mainreport.SubReports.Add(rep2);
            mainreport.SubReports.Add(rep3);
            mainreport.Render();
            mainreport.Show();
Thank you.
This is beyond my current knowledge & capabilities. Is there anyone out there that I can contract with to complete the setup of this main and sub-port?

Thank you,

Kent

Reference External Report

Posted: Fri May 27, 2011 5:48 pm
by timber0000
I have the main report created and a blank subreport inserted where the external report needs to show up. I also have the external report created. I don't know how to proceed from here and implement the code suggested by Ivan. Can anyone help me further?

Thank you,

Kent

Reference External Report

Posted: Mon May 30, 2011 2:55 am
by Andrew
Hello,

Please send us your sample project which shows your task and with what you have problems.

Thank you.

Reference External Report

Posted: Mon May 30, 2011 3:17 pm
by timber0000
I have attached the master report titled "Master Takeoff" and the standalone report titled "Nested Sheet Stock" that needs to be imported into the "Master Takeoff". In the "Master Takeoff", Page1, Databand8 at the top of the page needs to reference the "SubNstSummary" tab which needs to be linked to the standalone "Nested Sheet Stock" report. I would really like to know how to do what needs to be done. If there isn't any documentation available for this, could you direct me to the changes you make so that I could reverse engineer your solution?

Thank you,

Kent Swinson

Reference External Report

Posted: Wed Jun 01, 2011 6:57 am
by Alex K.
Hello,

Please see the sample project in attachment.

Thank you.

Reference External Report

Posted: Thu Jun 02, 2011 3:31 pm
by timber0000
Aleksey,
I copied the reports you posted into my project and proceeded to open them up. It appears that they are not working properly on my end because there isn't any difference in the display output between your modified version and my original version of the report. We are running StimulsoftReports.net, Version 2010.1.700. I had someone else look at what you sent me and they told me that your version was based on VB language and that we can't run VB with our system. What do I need to do to get past this hurdle. Thank you for your patience and assistance.

Kent

Reference External Report

Posted: Fri Jun 03, 2011 2:53 am
by Alex K.
Hello,

You can use the following C# code:

Code: Select all

try
{
    StiReport report = new StiReport();
    report.Load("MASTER TAKEOFF.mrt");

    //SubReport1
    Stimulsoft.Report.Components.StiSubReport SubReport1 = new Stimulsoft.Report.Components.StiSubReport();
    SubReport1.ClientRectangle = new Stimulsoft.Base.Drawing.RectangleD(0, 0, 7.7, 0.5);
    SubReport1.Name = "SubNstSummary";
    SubReport1.UseExternalReport = true;

    StiDataBand band = report.GetComponents()("DataBand8");
    band.Components.AddRange(new Stimulsoft.Report.Components.StiComponent[] { SubReport1 });
    report.GetSubReport += new StiGetSubReportEventHandler(report_GetSubReport);

    report.Render();
    report.Design();
}
catch
{
    MessageBox.Show(ex.Message);
}

void report_GetSubReport(object sender, StiGetSubReportEventArgs e)
{
    StiReport subReport = new StiReport();
    subReport.Load("NEST SUMMARY.mrt");
    e.Report = subReport;
}
Thank you.