Page 1 of 1

DecimalTochar Conversion

Posted: Mon Oct 16, 2006 10:48 pm
by ajmore
Hi all :)
I am using the transformer stage for converting decimal[9] to char[9].
i used the char(%number%) function but it does not provide any solution(also no warning or error msg. is their :roll: in log ) Then i used decimalTosting() function but this also does not provide me the solution..in fact it gives me the warning...
:!: APT_CombinedOperatorController,0: Conversion error calling conversion routine string_from_decimal data may have been lost

:idea: i also tried to used Modify stage.. it provide me the sol. but the output contains dots(i.e 037025735.) thus i am not able to use this data in join stage as the other dataset contains (037025735 data in char(9) format)thus join does not provide necessary result.......

Kindly Help me to resolve this issuse...
Thanks in advance...

Posted: Tue Oct 17, 2006 1:08 am
by bchau
Type Decimal fields will always has a byte for the sign and a byte for the decimal. So if you have Decimal[9,0] and it is a positive number your number will be like this: space+123456789+period

So what you want to do is trim the space and period.

Try Trim(Trim(DecimalToString(%num%,%option),'.'),' ')

The syntax may be incorrect as I don't have DS on this machine to confirm.