Null Pointer Exception BigDecimal

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!

 

 


Accepted Solutions
Five Stars

Re: Null Pointer Exception BigDecimal

I got the solution:

 

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


All Replies
Sixteen 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)
Eight Stars sgv
Eight 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

 

 

Sixteen Stars

Re: Null Pointer Exception BigDecimal

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

Five Stars

Re: Null Pointer Exception BigDecimal

I got the solution:

 

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

Eight Stars sgv
Eight Stars

Re: Null Pointer Exception BigDecimal

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

Re: Null Pointer Exception BigDecimal

That is what I suggested

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.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.