Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Exception in java.lang.String
mdu_gprabh
I am receiving the following error message when trying to access a field.
The data type of computed column "GRP" is java.lang.String, but one of its value is "null", which cannot be converted to java.lang.String.
I also tried the following code to force the field to assign space for null field.
row["IDENTIFIER"] == null?"": row["IDENTIFIER"]
Please help me in fixing the problem.
Thanks,
Prabu G
Find more posts tagged with
Comments
mwilliams
Hi Prabu G,
Can you add a check that returns the empty string "" if the value is null?
mdu_gprabh
Please let me know how to add a check. i could not get it clearly
mwilliams
Prabu G,
What is the expression you have for your computed column, "GRP"?
mdu_gprabh
if (row["TYPE"] = 'C' && (row["DATE"] >= row["CTS_DATE"]))
{
(row["IDENTIFIER1"]
}
{
row["IDENTIFIER2"]
}
I have the problem in IDENTIFIER2.
Thanks,
Prabu G
mwilliams
Prabu G,<br />
<br />
I'm assuming there's an "else" in there between the two identifiers. To check for a null value and replace it with an empty string, you'd just have to put another if/else in the else brackets like the following:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (row["TYPE"] = 'C' && row["DATE"] >= row["CTS_DATE"]){
row["IDENTIFIER1"];
}
else{
if (row["IDENTIFIER2"] == null){
"";
}
else{
row["IDENTIFIER2"];
}
}
</pre>
<br />
This should work assuming that there are null values in the "IDENTIFIER2" row that are causing the problem.
mdu_gprabh
Yes. I tried with this and also as the condition
row["IDENTIFIER"] == null?"": row["IDENTIFIER"]
But still throwing the same error.
Thanks,
Prabu G
mwilliams
Prabu G,
Can you attach your report design and include the entire error either in a screenshot or pasted into the forum? Also, what version of BIRT are you using? Thanks.
mdu_gprabh
PFA screen shot of the error in the report design. The size of the design is large and could not be attached. It is just a field when trying to use that field in computed column it is throwing the above exception. The version is Actuate BIRT 2.2.2
Thanks for your support.
Prabu G
mwilliams
Prabu G,
The reason I wanted the report design was to see exactly what you had for the code. I know you included some code in here, but I figured it wasn't exact because of the missing else. You said before that you knew it was the IDENTIFIER2. How were you able to figure that out? Could it possibly be a problem with IDENTIFIER1, putting out a null value that you could cover with a check statement too like I put around IDENTIFIER2?