Home
Analytics
Script engine error: TypeError: Cannot read property <anything> from null
dbmathis
Hi All,<br />
<br />
I have a data element in a report and the expression is string row["field1"]. I run the report and the element returns data.<br />
<br />
I try to use row["field1"].split() or row["field1"].length or any javascript against the string row["field1"] and it throws an error when I run the report.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot read property "length" from null
Script source: null, line: 0, text:
<compiled script> (Element ID:3265)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1237)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1216)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)
at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)</pre>
<br />
Any idea why I can't use javascript in this expression?
Find more posts tagged with
Comments
kclark
Trying using row["field1"].split(""); for the split that should work for you, if you are trying to get the length and you can use<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
BirtStr.charLength( row["field1"] )
</pre>
<br />
To get the length, it also matters where you are calling these from.
dbmathis
I am calling this from the expression of a data binding from a scripted data set. Once again if I just run it with row["field1"] in the expression the report returns data (see Figure1). I changed it to row["orgMembersData"].split("") and I get:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot call method "split" of null
Script source: null, line: 0, text:
<compiled script> (Element ID:3265)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1237)
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1216)
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)
at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)
</pre>
<br />
Figure1<br />
<img src='
http://tmfamily.info/screenshots/11-10-2012
12-29-39 PM.png' alt='Posted Image' class='bbc_img' />
dbmathis
.