Home
Analytics
Birt Exception
Krelek1000
Has Anyone ever encountered this error?
Data (id = 1748):
+ A BIRT exception occurred: Error evaluating Javascript expression. Script engine error: TypeError: Cannot find default value for object.
Script source: null, line: 6, text:
<compiled script>. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: Cannot find default value for object.
Script source: null, line: 6, text:
<compiled script>
What I am doing is I created a SQL Subdataset that looks at the WOSTATUS and the PERSON table. If a particular person put the status I am looking for, say INPRG, then I want to return that persons name to the field.
However if the SQL statement returns null, I get the above issue. I have built a small javascript list but it is the one returning the issue...
if (!subPlanner.fetch() == false)
{
"TEST"
}
else
{
"Electronically Signed by" + row["dname"];
}
The problem is the row["dname"] because it is undefined because the fetch is false but because I define the object here, it errors out with the exception. How can I define the object outside if the SQL fails or returns no value? Anyone have any suggests on how to fix this issue?
Thanks
Ben
Find more posts tagged with
Comments
SpaceMan
BIRT will fail on an error in Javascript and not process from there. From your pasted code, it looks as if you forgot a semicolon after "TEST":<br />
<br />
if (!subPlanner.fetch() == false)<br />
{<br />
"TEST"<strong class='bbc'>;</strong><
<br />
}<br />
else<br />
{<br />
"Electronically Signed by" + row["dname"];<br />
}<br />
<br />
If that doesn't work, use a variable and store row["dname"]. Then use a conditional:<br />
<br />
var variableName = row["dname"];<br />
<br />
if (variableName.length < 1)<br />
{<br />
"UH OH!!!!";<br />
}
Krelek1000
Hey thanks for the help Spacemen.
Unfortunately, I figured out that the reason BIRT was throwing the Exception error is that I had a data row in the Footer.
BIRT does not like having data rows in the footer when the SQL statement returns NULL. That is even though the data is null, the footer and the header will always appear.
I duplicated the lines and text on the footer of the subreport and put it in the details section, added the data rows to the parts of the details I wanted and then added a visibility condition to the footer. If the data is not null then show the details section otherwise show the footer. The error does not appear anymore!
Thanks
Ben Compton