[resolved] Convert with tConvertType null to new BigDecimal(0)

One Star

[resolved] Convert with tConvertType null to new BigDecimal(0)

Hello,
I have an input Db which contains columns only with Varchar and I want to convert this to the right type. Then I want save them in my DB.
But if I use the tConvertType component it cant convert a null Value to a BigDecimal value.
How I can convert null values to new BigDecimal(0)?
thx

Accepted Solutions
Community Manager

Re: [resolved] Convert with tConvertType null to new BigDecimal(0)

Hi 
Try to convert the data type on tMap with this expression:
row3.newColumn==null?new java.math.BigDecimal(0):new java.math.BigDecimal(row3.newColumn)
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post


All Replies
Community Manager

Re: [resolved] Convert with tConvertType null to new BigDecimal(0)

Hi 
Try to convert the data type on tMap with this expression:
row3.newColumn==null?new java.math.BigDecimal(0):new java.math.BigDecimal(row3.newColumn)
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post

2019 GARTNER 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

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog