Change page for a sub report

Stimulsoft Reports.WEB discussion
Post Reply
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Change page for a sub report

Post 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
Attachments
TestSubReportChange.zip
(2.27 KiB) Downloaded 85 times
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Change page for a sub report

Post 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.
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: Change page for a sub report

Post 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
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: Change page for a sub report

Post by cbrydon »

Hello,

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

Thank you,
Carl
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Change page for a sub report

Post by Lech Kulikowski »

Hello,

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

Thank you.
cbrydon
Posts: 173
Joined: Fri May 30, 2014 4:37 pm

Re: Change page for a sub report

Post by cbrydon »

Ok - Thank you Lech. Your sub-report suggestion will work just fine.

Carl
Max Shamanov
Posts: 786
Joined: Tue Sep 07, 2021 10:11 am

Re: Change page for a sub report

Post by Max Shamanov »

Hello,

You are welcome!
Post Reply