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

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch