Scripted Dataset: setInputParameterValue issue
Hi,<br />
<br />
i'm using Birt Report Designer 2.6.1 and I'm experiencing this issue. I've got a dynamic data set based on this query with place holder "?":<br />
<br />
[sql] SELECT ?, SUM(CLRED740), SUM(RV1), SUM(RV2_C2), SUM(RV10_C2),<br />
SUM(NCONTR), SUM(FRV1), SUM(FRV2_C2), SUM(FRV10_C2)<br />
FROM SCHEMA.MYTAB<br />
WHERE ? = ?<br />
GROUP BY ? [/sql]<br />
<br />
I've got 4 input parameters defined as Strings with respectively names: selCol (default value: params["CLASSEVAR"].value where CLASSEVAR is a cascade report input parameter), whereCol (default value: 1), whereVal (default value: 1), groupCol (default value: params["CLASSEVAR"].value where CLASSEVAR is a cascade report input parameter).<br />
<br />
On the beforeOpen event I attached this script to instantiate place holders dynamically:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.setInputParameterValue("selCol", params["CLASSEVAR"].value);
this.setInputParameterValue("groupCol", params["CLASSEVAR"].value);
logToDebugWindow("param CLASSEVAR: " + params["CLASSEVAR"].value);
logToDebugWindow("param selCol: " + this.getInputParameterValue("selCol"));
logToDebugWindow("param groupCol: " + this.getInputParameterValue("groupCol"));
if(params["ID_AREA"] != null && params["ID_AREA"].value != "")
{
this.setInputParameterValue("whereCol", "AREE");
this.setInputParameterValue("whereVal", reportContext.getParameterValue("ID_AREA"));
logToDebugWindow("param ID_AREA: " + reportContext.getParameterValue("ID_AREA"));
}
else if(params["ID_REG"] != null && params["ID_REG"].value != "")
{
this.setInputParameterValue("whereCol", "REG");
this.setInputParameterValue("whereVal", reportContext.getParameterValue("ID_REG"));
logToDebugWindow("param ID_REG: " + reportContext.getParameterValue("ID_REG"));
}
else if(params["ID_PROV"] != null && params["ID_PROV"].value != "")
{
this.setInputParameterValue("whereCol", "PROV");
this.setInputParameterValue("whereVal", reportContext.getParameterValue("ID_PROV"));
logToDebugWindow("param ID_PROV: " + reportContext.getParameterValue("ID_PROV"));
}
else
{
this.setInputParameterValue("whereCol", "1");
this.setInputParameterValue("whereVal", "1");
logToDebugWindow("Set where 1=1");
}
logToDebugWindow("QUERY SQL: " + this.queryText);
</pre>
<br />
Please ignore logToDebugWindow function call; it's a js script resource that opens a JFrame Java window to print some debug information locally. All the params are defined inside the report.<br />
I can't understand why, after setting input parameters with setInputParameterValue function, last line show me the query text with no params instantiated. Infact logToDebugWindow("QUERY SQL: " + this.queryText); shows the query with "?" in their original position even if input parameters are correctly setted with non null values.<br />
Should I call some other functions in this event or inside other events to have the query instantiated before fetching event?<br />
<br />
Thanks a lot in advance!<br />
<br />
P.S. Btw, I can't use breakpoints in the report designer on the beforeOpen event. All other events breaks correctly. Maybe it's a 2.6.1 bug