Page 1 of 1

Change page for a sub report

Posted: Fri Jul 08, 2022 11:36 am
by cbrydon
Hello,

I am wondering if there is a way to change the page that appears in a sub-report component.
I have a sample report attached that has 3 pages:
- a main page with a sub-report component
- page subReport_1 for the sub-report contents
- page subReport_2 for alternate sub-report components

The report also has a picklist with the following values: Page 1 and Page 2.
If a user chooses Page 1 from the list, I would like Page subReport_1 to be displayed in the sub-report control.
If a user chooses Page 2 from the list, I would like Page subReport_2 to be displayed in the sub-report control.

I've tried adding the following code to the BeginRender event of the report, but I don't have the syntax right
for setting the sub-report page
if (varPage == "Page 1")
{
SubReport1.subReportPage = subReport_1;
}
else
{
SubReport1.subReportPage = subReport_2;
}

Can you provide some guidance on how this might be acccomplished - if it even can be accomplished?

Note that there are no data sources in the report, as I am just interested in figuring out the functionality if possible.

I'm currently working with Version 2021.1.1 from 15 January 2021, ASP.NET, JS

Thank you,
Carl

Re: Change page for a sub report

Posted: Fri Jul 08, 2022 5:22 pm
by Lech Kulikowski
Hello,

You can add two SubReports components and hide one of them by Condition with the "Component Is Enabled" option depending on the variable value.

Thank you.

Re: Change page for a sub report

Posted: Fri Jul 08, 2022 6:46 pm
by cbrydon
Thank you for the suggestion Lech.

I will actually have about 20 pages in the report which would mean adding 20 sub-reports. I'd like to avoid that if I can - hence
my desire to add one sub-report and then change the page that appear in the sub-report. Is this possible with some modifications
to the code I included in the original post?

Thanks,
Carl

Re: Change page for a sub report

Posted: Mon Jul 11, 2022 4:41 pm
by cbrydon
Hello,

Do you have any additional thoughts on changing the page that appears in a sub-report control?

Thank you,
Carl

Re: Change page for a sub report

Posted: Wed Jul 13, 2022 9:28 pm
by Lech Kulikowski
Hello,

Unfortunately, directly in the report, it is not possible.

Thank you.

Re: Change page for a sub report

Posted: Thu Jul 14, 2022 12:12 am
by cbrydon
Ok - Thank you Lech. Your sub-report suggestion will work just fine.

Carl

Re: Change page for a sub report

Posted: Thu Jul 14, 2022 9:33 am
by Max Shamanov
Hello,

You are welcome!