How I can populate data in birt report by passing parameters in the URL

自闭症网瘾萝莉.ら 提交于 2019-12-13 05:47:28

问题


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";  

And i wrote my URL as :

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 :

The following items have errors:

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.


回答1:


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".



来源:https://stackoverflow.com/questions/23933326/how-i-can-populate-data-in-birt-report-by-passing-parameters-in-the-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!