[resolved] Round a number

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

Re: [resolved] Round a number


All Replies
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
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 !!
Four Stars

Re: [resolved] Round a number

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