Five Stars

Null Pointer Exception BigDecimal

Hey there,

 

I want to use this here:

 

(row5.SUMJHR ! = null ? row5.SUMJHR.toPlainString() : row5.SUMJHR)

 

talend gets me the error: "Type mismatch: cannot convert from Object&Serialzable&Comparable<?> to String"

 

Any Idea? The input row is BigDecimal.

 

Thanks a lot!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: Null Pointer Exception BigDecimal

I got the solution:

 

row5.SUMJHR == null ? null : row5.SUMJHR.toPlainString()

7 REPLIES
Twelve Stars

Re: Null Pointer Exception BigDecimal

You need to give me more info. For example, what is the field type that this is setting. I am assuming it is String. However, a quick solution might just be this....

 

(row5.SUMJHR ! = null ? row5.SUMJHR.toPlainString() : null)
Rilhia Solutions
Seven Stars sgv
Seven Stars

Re: Null Pointer Exception BigDecimal

(row5.SUMJHR ! = null ? row5.SUMJHR.toPlainString() : row5.SUMJHR)

 

i think your expression is wrong. Use this:

(row5.SUMJHR ! = null)? row5.SUMJHR.toPlainString() : row5.SUMJHR

 

Be sure that your output is a String type

 

SGV

 

 

Twelve Stars

Re: Null Pointer Exception BigDecimal

@sgv there is no difference between those two expressions. The brackets do nothing

Rilhia Solutions
Five Stars

Re: Null Pointer Exception BigDecimal

I got the solution:

 

row5.SUMJHR == null ? null : row5.SUMJHR.toPlainString()

Seven Stars sgv
Seven Stars

Re: Null Pointer Exception BigDecimal

I just tested ! You're right =)
Twelve Stars

Re: Null Pointer Exception BigDecimal

That is what I suggested

Rilhia Solutions
Moderator

Re: Null Pointer Exception BigDecimal

Hello,

Please mark solution as accepted if it is OK with you question.

Best regard

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.