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
Fifteen Stars TRF
Fifteen 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
Fifteen Stars TRF
Fifteen 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.
Highlighted
Six Stars

Re: How to replace null values with numeric value

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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog