two decimal places

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

two decimal places

Post 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.
Thanx&Regards
scorpion
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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]
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Post by scorpion »

Hi Arndw,

Thanks for the reply and I am looking to truncate to 2 decimal places while converting from float to string.
Thanx&Regards
scorpion
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Post by scorpion »

Hi Arndw,

Thanks for the reply and I am looking to truncate to 2 decimal places while converting from float to string.
Thanx&Regards
scorpion
Post Reply