BIRT 报告 - 通过脚本添加参数



我有一个使用如下查询的 BIRT 报告。

select Dealer, Name from customerA where id = ? union all select Code as Dealer, last_name as Name from customerB where id = ? union all select Num as Dealer, owner as Name from customerC where id = ?

我在报告本身中有一个输入文本框和一个刷新按钮,用于重新加载报告。此外,我的报表具有名为"CUST_ID"的参数,我在数据集中将其绑定为 param_1,param_2,并在执行时param_3替换为"?"标记。

如果我在参数弹出屏幕上输入参数报告工作正常,但我需要在文本框中输入 ID,一旦我按下刷新链接,请相应地重新加载报告。

如何添加输入文本值(我知道我可以从脚本中获取它)并将其设置为报告参数"CUST_ID"?

非常感谢您的帮助。

提前谢谢你。

我能够通过使用 BIRT 中的脚本来解决此问题。 下面我列出了我遵循的步骤。

1.添加一个脚本,该脚本将在页面加载时启动请求参数。 我能够通过在普通 JavaScript 函数中使用 var link=this; 来访问的报告 URL。

2.将我的参数附加到请求的末尾,如上面 James 所述。 谢谢詹姆斯。

3.替换新创建的网址link.href=url; 这将使用我在输入框中输入的值刷新报告。

4.in 数据集中,我将查询修改为没有任何 where 子句的'Select name from customerA'

5.数据集 beforeOpen脚本 我添加了这些行,并相应地过滤了记录。

this.queryText += "where id ="+reportContext.getParameterValue("cust_id");
reportContext.setParameterValue("debug", this.queryText);

最新更新