tXMLMap Expression Help

One Star

tXMLMap Expression Help

Hi,
this is my input : Mont = 129483948 ( type of Mont is string)
in my out put i need to have this : res =1294839,48 ( type of is BigDecimal )
Thank you for your help.
Community Manager

Re: tXMLMap Expression Help

In your output (I will call it the "RES" column) you need the following. I am assuming the input row is "row1" and the input column is "MONT"...
row1.MONT!=null ? new BigDecimal(row1.MONT) : null

This checks to see that the MONT value is not null and then converts it to a BigDecimal if it is not null. If it is null, it just sets the output column to null.
Highlighted
One Star

Re: tXMLMap Expression Help

Thank you for your response, but me i retrive the input from a xsd scheme like this :

So how to do it ?
One Star

Re: tXMLMap Expression Help

after adding your expression i get this error :
Community Manager

Re: tXMLMap Expression Help

It looks like you have a non numeric value in your number (maybe a monetary unit?) or the value is an empty string. If it is the non numeric unit, you will need to remove it. If it is an empty string, you need to filter those from being processed.
For example....
row1.MONT!=null && row1.MONT.trim().compareToIgnoreCase("")!=0 ? new BigDecimal(row1.MONT) : null
One Star

Re: tXMLMap Expression Help

Thank you it works.
Regards

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

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog