How to replace null values with numeric value

Six Stars

How to replace null values with numeric value

Hi, 

I'm getting some null values from source column which column having a Number as data type, I want to replace null value with "500" in tMap. I tried with row1.Rate!=null?500:row1.rate but it is throwing the following error.

 

Error Line: 1119
Detail Message: Type mismatch: cannot convert from Number&Comparable<?> to BigDecimal
There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio.

 

Kindly advise.

 

Regards,

 

 


Accepted Solutions
Highlighted
Forteen Stars TRF
Forteen Stars

Re: How to replace null values with numeric value

Here it is:

row2.rate == null ? new BigDecimal("500") : row2.rate

Hope this helps.

 


TRF
Moderator

Re: How to replace null values with numeric value

Hi,

Did you compare BigDecimal value with null? If so, 500 is an int, you cannot assign it to a BigDecimal column.

Best regards

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.

All Replies
Highlighted
Forteen Stars TRF
Forteen Stars

Re: How to replace null values with numeric value

Here it is:

row2.rate == null ? new BigDecimal("500") : row2.rate

Hope this helps.

 


TRF
Moderator

Re: How to replace null values with numeric value

Hi,

Did you compare BigDecimal value with null? If so, 500 is an int, you cannot assign it to a BigDecimal column.

Best regards

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.
Six Stars

Re: How to replace null values with numeric value

it is not giving any error but is not replacing with value.