Convert String to BigDecimal

One Star

Convert String to BigDecimal

Hi,
I have a problem writing an expression in tMap. I want to convert a field which is a String to a field which is BigDecimal.  I also need to check the content of String field - if it has "szt" then I need to send 1 and if not then I need to send the value of the field (converted to BigDecimal).
Thanks for all the suggestions because I'm stuck :/
One Star

Re: Convert String to BigDecimal

str == null ? null : (str.contains("szt") ? new BigDecimal(1) : new BigDecimal(str))
Lin LIN
Consultant BI/Talend
Synaltic Group

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