I am using SpagoBI, and I am trying to create report with optional parameter. I have problem with beforeOpen() script. Here is the query.
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 C."REGION" in (?)
and the script
if (params["cityparam"].value != null){
this.queryText = this.queryText + "and C.\"CITY\" in ( ?,'" +params["cityparam"].value + "')";
}
else{
var str = reportContext.getParameterValue("regionparam");
q3 = this.queryText + "and C.\"CITY\" in (?,( select \"CUSTOMER\".\"CITY\" from \"CUSTOMER\" where \"CUSTOMER\".\"REGION\" in ('"+ str +"')))";
this.queryText =q3;
}
I have 2 parameters, regionparam and cityparam the second one is optional. I am trying to modify the query in this way, that when cityparam isn't set, I am comparing C."CITY" to all it's possible values in selected region. The generated query works in my PGadmin. But there are problems in SpagoBI studio. It's says:
Subquery returned more than 1 value. This is not permitted
Is there any BIRT master? I would be greatfull for help. Thanks.