如何通过在URL中传递参数来填充Birt报告中的数据 [英] How I can populate data in birt report by passing parameters in the URL

查看:83
本文介绍了如何通过在URL中传递参数来填充Birt报告中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在BIRT报告的URL中传递参数.在我的报告中,有3个参数,例如StoreId,fromdate和todate.我还尝试在Birt中编写我的dataSet的beforeOpen脚本的代码.它是:

I want to pass the parameters in the URL of the BIRT Report. In my reports there are 3 parameters like StoreId, fromdate and todate. I have also tried to write the code of beforeOpen Script of my dataSet in the Birt. Its is as :

var store_id;
var from_date;
var to_date;

store_id = params["Store_id"].value;
from_date = params["fromdate"].value;
to_date = params["todate"].value;

this.queryText = this.queryText+" where STORE_ID = "+store_id+" AND TRANSFER_DATE BETWEEN "+from_date+" AND "+to_date+ "ORDER BY TRANSFER_DATE ASC";  

我的网址写为:

http://localhost:8080/birt/run?__report=adminMasterTransferReport_new.rptdesign&Store_id=1&fromdate=2014-04-26&todate=2014-06-06

在报告的结尾,我得到了这样的错误:

At the end of the report I am getting such error :

以下各项有错误:

ReportDesign (id = 1):
+ There are errors evaluating script "var store_id;
var from_date;
var to_date;

store_id = params["Store_id"].value;
from_date = params["fromdate"].value;
to_date = params["todate"].value;

this.queryText = this.queryText+" where STORE_ID = "+store_id+" AND TRANSFER_DATE BETWEEN "+from_date+" AND "+to_date+ "ORDER BY TRANSFER_DATE ASC";



":
Fail to execute script in function __bm_beforeOpen(). Source:
------
" + var store_id;
var from_date;
var to_date;

store_id = params["Store_id"].value;
from_date = params["fromdate"].value;
to_date = params["todate"].value;

this.queryText = this.queryText+" where STORE_ID = "+store_id+" AND TRANSFER_DATE BETWEEN "+from_date+" AND "+to_date+ "ORDER BY TRANSFER_DATE ASC";



 + "
-----
A BIRT exception occurred. See next exception for more information.
Report parameter "Store_id" does not exist..

如果有人知道,那就帮助我.

If anyone knows then help me.

推荐答案

确保报表参数名称与URL中给定的名称相匹配.您正在此脚本中查找名为"Store_id"的报表参数,但在问题的第一段中将名称声明为"StoreId".我认为您需要从"StoreId"->"Store_id"更改报表参数名称.

Make sure the Report Parameter Name matches the one given in the URL. You are looking for the Report Parameter named "Store_id" in this script but in the first paragraph of your question you state the name as "StoreId". I think you need to change the Report Parameter name from "StoreId" -> "Store_id".

这篇关于如何通过在URL中传递参数来填充Birt报告中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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