how to enable or disable a sub-report using variables?

Stimulsoft Reports.PHP discussion
Post Reply
gabrielw3n
Posts: 14
Joined: Mon Aug 21, 2017 5:10 pm

how to enable or disable a sub-report using variables?

Post by gabrielw3n »

Hi.

I'm trying to enable or disable a subreport in a list of three subreports using a 'filter' variable.

Something like 'if filter is equals one, then remove or ignore the number one report'.

I was trying to do it stimulsoft designer using this code:

Code: Select all

	if (this.filter== "1") {
				this.subReport_1.Enabled = false;
				
			} else if (this.filter== "2") {
				this.subReport_2.Enabled = false;
				
			}
and in the preview seems to work, but when I call through the application, the Enabled is just ignored and all subreports pops up.

The code I'm using in viewer.php to show open the report is the following:

Code: Select all

// Load and show report
		var report = new Stimulsoft.Report.StiReport();
		//report.subReport_1.Enabled = false;
		report.loadFile("reports/Report3.mrt");
		
		report.dictionary.variables.getByName("filter").valueObject = "2";
		
		 
		viewer.report = report;
		viewer.renderHtml("viewerContent");
Can someone help me please?
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: how to enable or disable a sub-report using variables?

Post by Ivan »

Hello,

Unfortunately, due to technology limitations, compilation and scripts do not work in js/flex engines.
So please use the Condition feature.
Note: by design condition do not apply to the subreports, so you need to place subreports to the panels and apply conditions to the panels.
Please check the sample report template in the attachment.

Thank you.
Attachments
condition.mrt
(6.71 KiB) Downloaded 400 times
Post Reply