Page 1 of 1

Truncate and Round Float type data

Posted: Mon Jun 10, 2013 12:15 am
by suresh.narasimha
Hi

I have a Sybase source with Column A as Float. I want to Truncate the value of decimals to 8 places and round it and if there is a zero after decimal place, that should be padded with 8 zeroes.

My job design is

Sybase Src (Float) ---> Transfrmer ----> Sequential file (Float)

I didn't find a function to do this in Transformer.

Please suggest how can I do this.

Thanks
Suresh

Posted: Mon Jun 10, 2013 6:10 am
by chulett
Can you post some input and output examples, please?

Float data type trunc and round

Posted: Mon Jun 10, 2013 3:10 pm
by suresh.narasimha
Hi Chulett

Here is some sample data input and desirable output

Code: Select all

Input                               Output  (8 decimals)
=====                           ==========
0                               0.00000000  - Padded with zeroes 
1.22334222765                   1.22334223  - Truncate and Round
1.23244                         1.23244000  - Truncate and Round 


Thanks

Posted: Mon Jun 10, 2013 4:38 pm
by chulett
Thanks for that. Added some

Code: Select all

 tags so the example was readable.

Just want to point out that your target field will need to be a [i]string,[/i] not another float, if you want to control the formatting like that.