BIRT报告-通过脚本添加参数 [英] BIRT reports - add parameter through script

查看:280
本文介绍了BIRT报告-通过脚本添加参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个BIRT报告,该报告使用如下查询.

I have a BIRT report that uses a query like below.

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 = ?

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以替换为?"在执行时标记.

I have a input text box in the report itself and a refresh button which reload the report. also my report have parameter called 'CUST_ID' which i bound in the dataset as param_1,param_2 and param_3 to replace with '?' mark while executing.

如果我在参数弹出屏幕上输入参数,报告工作正常,但我需要在文本框中输入ID,然后按相应的刷新链接重新加载报告.

if i enter the parameter on parameter popup screen report works fine , but i need to enter the id in the text box and once i press the refresh link reload report accordingly.

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

How can i add the input text value ( i know i can get it from a script ) and set it to the report parameter 'CUST_ID' ?

非常感谢您的帮助.

谢谢.

推荐答案

我能够通过使用BIRT中的脚本来解决此问题.下面我列出了我要执行的步骤.

I was able to fix this by using scripts in BIRT. below i listed the steps i follow.

1.添加一个脚本,该脚本将在页面加载时启动请求参数. 报告网址,我可以通过在常规javascript函数中使用var link=this;进行访问.

1.add a script that will initiate the request parameters on page load. report url i was able to access by using var link=this; inside a normal javascript function.

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

2.Append my parameter to the end of the request as mentioned by james above. thanks james.

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

3.replace the newly created url link.href=url; This will refresh the report with the value i entered in the input box.

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

4.in data set i modified my query as 'Select name from customerA' without any where clause.

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

5.dataset beforeOpen script i added these line and records are filterd accordingly.

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

这篇关于BIRT报告-通过脚本添加参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆