Reference External Report

Stimulsoft Reports.NET discussion
Post Reply
timber0000
Posts: 7
Joined: Fri May 20, 2011 7:43 pm
Location: Manhattan, KS

Reference External Report

Post 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
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Reference External Report

Post 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.
timber0000
Posts: 7
Joined: Fri May 20, 2011 7:43 pm
Location: Manhattan, KS

Reference External Report

Post 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
timber0000
Posts: 7
Joined: Fri May 20, 2011 7:43 pm
Location: Manhattan, KS

Reference External Report

Post 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
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Reference External Report

Post by Andrew »

Hello,

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

Thank you.
timber0000
Posts: 7
Joined: Fri May 20, 2011 7:43 pm
Location: Manhattan, KS

Reference External Report

Post 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
Attachments
1047.STI RPTS.zip
(20.92 KiB) Downloaded 225 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Reference External Report

Post by Alex K. »

Hello,

Please see the sample project in attachment.

Thank you.
Attachments
1049.SampleProjectVB.zip
(43.95 KiB) Downloaded 252 times
timber0000
Posts: 7
Joined: Fri May 20, 2011 7:43 pm
Location: Manhattan, KS

Reference External Report

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Reference External Report

Post 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.
Post Reply