Page 1 of 1

two decimal places

Posted: Mon Jan 07, 2008 12:10 pm
by scorpion
I have my job is like:

source columns
A--(double,15)
B--(double,15)

TARGET: C(varchar)

I am populating target C with B and converting in to varchar.

the code using now like: dfloattostringnoexp(col.B,15)

this is working fine.but But now i have a change request like


if columnA='XXX' Then populate target column with B and should haveonly 2 decimal places,else populate B.


How to acheive this without using basic transformer using'FMT'function.

The reason behind this is If i use basic ,i am not able to find the dfloattostringnoexp()function(to convert double to varchar).

Is there any function available in normal transformer stage to populate only with 2 decimal places.

appreciate the help.

Posted: Mon Jan 07, 2008 12:51 pm
by ArndW
I am confused from your post if you are looking to truncate to 2 decimal places while converting from float to integer or converting the string. The first could be done by math, i.e. INT(In.Col*100)/100; the latter by In.Col[1,INDEX(In.Col,'.',1)+2]

Posted: Tue Jan 08, 2008 3:42 am
by scorpion
Hi Arndw,

Thanks for the reply and I am looking to truncate to 2 decimal places while converting from float to string.

Posted: Tue Jan 08, 2008 3:43 am
by scorpion
Hi Arndw,

Thanks for the reply and I am looking to truncate to 2 decimal places while converting from float to string.