I want to define two report into one template. I want to show the second report based on a condition. Is this possible?
Question Conditional pages
Re: Question Conditional pages
Support · Jul 3, 2012Hello,
You can add multiple reports to the report template(DPLX) but it is not possible to apply conditions to hide and show the reports. You can achieve your requirements by creating two separate templates(DPLX) and you can generate reports dynamically depending on your conditions and add the pages to the main report by looping through the list of pages of your second report. Below is the sample code for it.
bool isTrue = true;
//Code to generate main report.
DocumentLayout mainReport = new DocumentLayout(@"C:\V6Document.dplx");
Document mainDocument = mainReport.Run();
//Sample code to build another report depending on your condition and adding the pages to the main report.
if (isTrue)
{
DocumentLayout secondaryReport = new DocumentLayout(@"C:\v6Document2.dplx");
Document secondaryDocument = secondaryReport.Run();
if (secondaryDocument.Pages.Count > 0)
{
foreach (Page page in secondaryDocument.Pages)
{
mainDocument.Pages.Add(page);
}
}
}
mainDocument.Draw(@"C:\MyDocument.pdf");
Please note that this thread was been moved to this forum (DynamicPDF ReportWriter for .NET) as it was posted incorrectly in a forum for a different product.
Thanks,
ceTe Software support Team