Search code examples
javaparametersbirtspagobi

SpagoBI multi value parameter


I'm trying to create a multi-value parameter in SpagoBI.

Here is my data set query whose last line appears to be causing an issue.

select C."CUSTOMERNAME", C."CITY", D."YEAR", P."NAME"
from "CUSTOMER" C, "DAY" D, "PRODUCT" P, "TRANSACTIONS" T
where C."CUSTOMERID" = T."CUSTOMERID"
and D."DAYID" = T."DAYID"
and P."PRODUCTID" = T."PRODUCTID"
and _CITY_

I created before open script in my dataset which looks like this:

this.queryText = this.queryText.replace(_CITY_, " CUSTOMER.CITY in ( "+params["cp"].value+" ) "); 

My parameter is set as string, display type dynamic list box.

When I run the report I'm getting that error.

org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "
this.queryText = this.queryText.replace(_CITY_, " CUSTOMER.CITY in ( "+params["cp"].value+" ) "); 
":
Fail to execute script in function __bm_beforeOpen(). Source:

Could anyone please help me?


Solution

  • Hello I managed to solve the problem. Here is my code:

    var substring = "" ;
    var strParamValsSelected=reportContext.getParameterValue("citytext");
    substring += "?," + strParamValsSelected ;
    this.queryText = this.queryText.replace("'xxx'",substring);
    

    As You can see the "?" is necessary before my parameter. Maybe It will help somebody. Thank You so much for Your comments.