how to enable or disable a sub-report using variables?
Posted: Tue Aug 22, 2017 6:29 pm
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:
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:
Can someone help me please?
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;
}
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");