我曾经使用过更多可选参数,比如国家,州,城市,我在打开之前写了一些脚本,但它没有用...
开放之前::
if (params["productline"].value && params["country"].value)
{
q1=this.queryText = this.queryText + " AND PRODUCTLINE = '" + params["productline"].value +"'"+" and COUNTRY = '" + params["country"].value + "'"+"group by country";
reportContext.getDesignHandle().findParameter("state").dropAndClear();
reportContext.getDesignHandle().findParameter("city").dropAndClear();
Packages.java.lang.System.out.println ("Query1:" +q1);
}
else if (params["productline"].value && params["state"].value)
{
q2=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and state = '" + params["state"].value + "'"+ " group by state";
reportContext.getDesignHandle().findParameter("country").dropAndClear();
reportContext.getDesignHandle().findParameter("city").dropAndClear();
Packages.java.lang.System.out.println ("Query3:" +q2);
}
else
{
q3=this.queryText = this.queryText + " AND productline = '" + params["productline"].value +"'"+" and city = '" + params["city"].value + "'"+ " group by city";
Packages.java.lang.System.out.println ("Query3:" +q3);
reportContext.getDesignHandle().findParameter("state").dropAndClear();
reportContext.getDesignHandle().findParameter("city").dropAndClear();
}
答案 0 :(得分:1)
如果您正在使用以下link1 link2提供的屏幕截图
你必须在这样的javascript中做一个简单的逻辑
var rptFlag =“”
如果选择 counrty ,则指定rptFlag = 'country'
如果选择州,则指定rptFlag = 'state'
如果选择城市,则指定rptFlag = 'city'
将此作为 rptFlag 参数传递给报告,
在开放之前
你必须像这样检查......
if (params["rptFlag"].value=='country')
{
/* your query */
}
else if (params["rptFlag"].value=='state')
{
/* your query */
}
else
{
/* your query */
}