Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Birt Parameter Error(Cannot read property "length" from null)
Birt Parameter Error [message #1126962] Sun, 06 October 2013 05:14 Go to next message
Praba Krishna is currently offline Praba Krishna
Messages: 1
Registered: October 2013
Junior Member
Hi friends,
I needed to create a set of parameters on a BIRT report that allowed the user to select
from a list of items. The selection had to allow for just a single item to be selected, or for a range or multiple, non-contiguous ranges or items to be selected.
Plus I wanted to allow the user to click a single check box to select all items if
required.

But when I try to run this report I get this error.
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.3.2.r232_v20090211
Error Code:data.engine.BirtException
Error Message:A BIRT exception occurred: There are errors evaluating script "__bm_beforeOpen()":
TypeError: Cannot read property "length" from null (<inline>#8).. See next exception for more information.
There are errors evaluating script "__bm_beforeOpen()":
TypeError: Cannot read property "length" from null (<inline>#8).

Please assist..

My First DataSet
**************************************************
sqlText = with rasheem as(
select invbalances.curbal curbal, issuetype ,matusetrans.itemnum itemnum,matusetransid ,
description ,CONVERT(date,transdate ) as transdate,transdate act_transdate
,storeloc ,refwo ,matusetrans.binnum binnum,quantity ,p1.displayname enterby,
memo ,p2.displayname issueto
from matusetrans
join invbalances on matusetrans.itemnum =invbalances.itemnum
join person p1 on matusetrans.enterby=p1.personid
join person p2 on matusetrans.issueto =p2.personid )
select itemnum, matusetransid
from rasheem
**************************************************
and fetch
***************************************************
row["itemnum"] = maximoDataSet.getString("itemnum");
row["matusetransid"] = maximoDataSet.getInteger("matusetransid");
return (true);
******************************************************
My Second Data Set
******************************************************
sqlText = with mokkai as(
select invbalances.curbal curbal, issuetype ,matusetrans.itemnum itemnum, matusetransid,
description ,CONVERT(date,transdate ) as transdate,storeloc ,refwo ,matusetrans.binnum binnum,quantity ,p1.displayname enterby,
memo ,p2.displayname issueto
from matusetrans
join invbalances on matusetrans.itemnum =invbalances.itemnum
join person p1 on matusetrans.enterby=p1.personid
join person p2 on matusetrans.issueto =p2.personid
where issuetype ='issue' and enterby in('oommenj'))
select curbal, issuetype , itemnum, matusetransid,
description ,transdate,storeloc ,refwo ,binnum,quantity , enterby,
memo ,issueto from mokkai where transdate > = '08/22/13'
and transdate < = '08/22/13'
**********************************************************
and fetch
***********************************************************
row["curbal"] = maximoDataSet.getDouble("curbal");
row["issuetype"] = maximoDataSet.getString("issuetype");
row["itemnum"] = maximoDataSet.getString("itemnum");
row["description"] = maximoDataSet.getString("description");
row["storeloc"] = maximoDataSet.getString("storeloc");
row["refwo"] = maximoDataSet.getString("refwo");
row["binnum"] = maximoDataSet.getString("binnum");
row["quantity1"] = maximoDataSet.getString("quantity");
row["transdate1"] = maximoDataSet.getDate("transdate");
row["enterby"] = maximoDataSet.getString("enterby");
row["memo1"] = maximoDataSet.getString("memo");
row["issueto1"] = maximoDataSet.getString("issueto");
row["matusetransid"] = maximoDataSet.getString("matusetransid");
return (true);
****************************************************************
on the second data set on beforeOpen event I've created this
//Get the report parameters
ParamItem = reportContext.getParameterValue("Item");
ParamAllItems = reportContext.getParameterValue("AllItems");
//Generate comma seperated list of customers
ItemList ="";
i = 0
for
(i; i<ParamItem.length; i++)
{
ItemList += ParamItem[i] +","
};
//Remove final comma
ItemList=ItemList.substring(0,ItemList.length-1);
//If all customers was not selected then add the customer list to the query
if
(ParamAllItems==false)
{
this.queryText +=" WHERE matusetransid IN ("+ ItemList +")" ;
}
**************************************************************
When I try to execute it I get this error..

A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.3.2.r232_v20090211
Error Code:data.engine.BirtException
Error Message:A BIRT exception occurred: There are errors evaluating script "__bm_beforeOpen()":
TypeError: Cannot read property "length" from null (<inline>#8).. See next exception for more information.
There are errors evaluating script "__bm_beforeOpen()":
TypeError: Cannot read property "length" from null (<inline>#8).

********************************************************************
All your assistance will be highly appreciated.
Re: Birt Parameter Error [message #1129088 is a reply to message #1126962] Tue, 08 October 2013 09:20 Go to previous message
donino donino is currently offline donino donino
Messages: 162
Registered: July 2011
Senior Member
Hi,

firstly here is a small tip to simplify your script, rather than a loop we can build itemList with a simple function:
ItemList = ParamItem.join(",");

It appears the ParamItem is empty in the beforeOpen event of the second dataset when it is triggered. If users select the checkbox the ParamItem remains undefined, you should at first check the value of allItems, something like this:

if(ParamAllItems==false){
 this.queryText +=" WHERE matusetransid IN ("+ ItemList +")" ;
}else{
  if (ParamItem!=null){
    this.queryText +=" WHERE matusetransid IN ("+ ParamItem.join(",")+")" ;
  }
}

With this code, note if users don't select any value in ParamItem, then all values are returned.
Where the second dataset is invoked? In the report body or as a datasource of another parameter?
Previous Topic:Global Variables not working in Web Viewer
Next Topic:Package with uri "ChartModel" not found
Goto Forum:
  


Current Time: Fri Oct 24 12:09:22 GMT 2014

Powered by FUDForum. Page generated in 0.01719 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software