Page 1 of 1

How to Concatinate two Report?

Posted: Thu Dec 20, 2012 12:53 pm
by amitkaushik
Hi,

I have more then one Reports and looking to display them with in the same UI dynamicly.

Thanks

Re: How to Concatinate two Report?

Posted: Thu Dec 20, 2012 2:19 pm
by HighAley
Hello.

If you need to join reports you could use next code:
StiReport rep1 = new StiReport();
rep1.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report1.mrt");
rep1.Compile();
rep1.Render();

StiReport rep2 = new StiReport();
rep2.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report2.mrt");
rep2.Compile();
rep2.Render();

StiReport joinedReport = new StiReport();
joinedReport.SubReports.Add(rep1, false, true);
joinedReport.SubReports.Add(rep2, false, true);

joinedReport.Show();
Thank you.

Re: How to Concatinate two Report?

Posted: Fri Dec 21, 2012 5:36 am
by amitkaushik
Thanks, Code is good, but i have multiple function creates different-different mrt report accordingly in a defined order (Order change according to user request).

Here I need to append report according to that order.
Hope u get what I want to define.

Regards :)

Re: How to Concatinate two Report?

Posted: Sat Dec 22, 2012 12:53 pm
by HighAley
Hello.

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.

Re: How to Concatinate two Report?

Posted: Mon Dec 24, 2012 4:57 am
by amitkaushik
Yes, I put your code in my application but the problem is, let have example;

stireport function1()
{
StiReport rep1 = new StiReport();
rep1.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report1.mrt");
rep1.Compile();
rep1.Render();

StiReport rep2 = new StiReport();
rep2.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report2.mrt");
rep2.Compile();
rep2.Render();

StiReport joinedReport = new StiReport();
joinedReport.SubReports.Add(rep1, false, true);
joinedReport.SubReports.Add(rep2, false, true);
return joinedReport ;
}

Function2()
{
StiReport rep3 = new StiReport();
rep3.Load(@"f:\Support\com\zhang.rs@comlan.com\MSI-444125\Report3.mrt");
rep3.Compile();
rep3.Render();

StiReport FinaljoinedReport = new StiReport();
FinaljoinedReport.SubReports.Add(function1(), false, true);
FinaljoinedReport.SubReports.Add(rep3, false, true);

FinaljoinedReport.Show();
}

Here final report only show report generated with function1().
if i change the order like;

FinaljoinedReport.SubReports.Add(rep3, false, true);
FinaljoinedReport.SubReports.Add(function1(), false, true);

then it work fine.

thanks

Re: How to Concatinate two Report?

Posted: Wed Dec 26, 2012 6:15 am
by HighAley
Hello.

What's stopping you to add all sub-reports in one function?

Thank you.