Modify the Dataset by Script

There are instances in which you would like to modify the dataset query based upon parameter values, either the first value which may be "All Values" or just one parameter value. 

The following script worked for me: 
var paramSelect = reportContext.getParameterValue("OptionParameter");
var selected = "'" + paramSelect + "'";
 if(paramSelect != "All Options"){ 
this.queryText += " and table.field = " + selected ; 
}

I discovered that you cannot add the single quotes for the selected in the this.queryText string, such as:
this.queryText += " and table.field = ' " + selected + " ' "; // this does not work

 It works when you add the single quotes in the variable as above.

Comments

Popular posts from this blog

Installing Birt Reports

Global Variables

Display Parameter Text