[resolved] Round a number

Highlighted
One Star

[resolved] Round a number

Hello,
I read in a tMap an Excel cell who can be "null" or contain a number with delimiter (1 111) and can be décimal (1 111,11...111).
The input format is string, the input format is string.
I try getting the number like that :
9 876 543 --> 9876543 (without separator)
or
1 234 567,55 -> 1234568 (without separator and rounded)
Then I test that :
Relational.ISNULL(row11.newColumn8)?""Smiley FrustratedtringHandling.CHANGE(row11.newColumn8," ","")
For the separator, it's ok, but I cannot round the number.
Please, help me ...
Thank-you
Quartz92

Accepted Solutions
Highlighted
Four Stars

All Replies
Highlighted
Four Stars

Re: [resolved] Round a number

In order to round the number, first you will have to change the data type to decimal and then apply round function
Vaibhav
Highlighted
One Star

Re: [resolved] Round a number

Thank-you sanvaibhav,
The decimal data type to use is "integer" ?
Then I must do :
Relational.ISNULL(row11.newColumn8)?"":ConvertTypes.String2Int(StringHandling.CHANGE(row11.newColumn8," ",""))
to convert before use round ?
I don't find a round function to use in a tMap.
Do you have more instructions to help me ?
Thank-You !!
Highlighted
Four Stars
Highlighted
One Star

Re: [resolved] Round a number

Thank-you sanvaibhav,
The two metods you purpose are in Java ... is it possible to do the same thing in a tMap Talend ?
Highlighted
Four Stars

Re: [resolved] Round a number

You can use Java anywhere possible in Talend...
Yes, you can use it tMap as well... Use Ctrl+Space you can get inbuild java functions/routines implemented by talend..
Vaibhav
One Star

Re: [resolved] Round a number

Thank-you sanvaibhav !!

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