a problem with rounding a series of numbres

One Star

a problem with rounding a series of numbres

Hi,
i've a problem with rounding a series of numbres.
for exemple :
1|2012|1|1.7108333333333332|6.591666666666668|50.5225|2.098333333333333|33394.35
i've tried with "tmap", and the expression was DataOperation.FIX(value)
It worked and i've got this resulat :
1|2012|1|2.0|7.0|51.0|2.0|33394.0

but i would like to keep the 2 last numbre after the decimal,
just like
1|2012|1|1.71|6.59|50.52|2.10|33394.35
i have tried with DataOperation.FIX(value,2) and (DataOperation.FIX(value*100))/100
it didn't work...
and does anyone can help me?? where can i set up the precision?
thanks
Miao
One Star

Re: a problem with rounding a series of numbres

Hi Miao
Just modify the schema of input component as the following images.
Regards,
Pedro
One Star

Re: a problem with rounding a series of numbres

hi,
how are you?

i've modified the schema of input component, but there is a error :
The method FIX(double) in the type DataOperation is not applicable for the arguments (BigDecimal)...
One Star

Re: a problem with rounding a series of numbres

Hi Miao
I'm fine. Smiley Wink
Create job as follow.
tFileInputDelimited --> tLogRow
There is no need to use FIX() method here.
Hope this can help you.
Regards,
Pedro
One Star

Re: a problem with rounding a series of numbres

Can i send a mail to you with my job, because i have other components before this step...
Hi Miao
I'm fine. Smiley Wink
Create job as follow.
tFileInputDelimited --> tLogRow
There is no need to use FIX() method here.
Hope this can help you.
Regards,
Pedro
One Star

Re: a problem with rounding a series of numbres

Hi
No problem. Just send it to me.
Regards,
Pedro
One Star

Re: a problem with rounding a series of numbres

Hi
How about the problem?
Is that solved?
I'm in same problem.
I use TOS v5.1.1.

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