Page 1 of 1

zero output as 0.00

Posted: Thu Feb 28, 2008 1:15 pm
by gmt_etldev
Hello,
I am having a problem with the display of zero as 0, yet I want it to display as 0.00. I have tried the results of other postings, with no success. I have switched datatypes, suppressed zeroes, converted to a double or float, if-then-else, etc. - but it is still not working.

In the transformer stage:
Input: Decimal 38,2
Stage Variable: Decimal 38,2 used to calculate an amount
Output: Varchar 40 with a
DecimalToString(STAGE_VARIABLE_NAME_HERE,"suppress_zero") conversion.

I still get 0 where I need 0.00

Any ideas?

Thanks,
Barbara

Posted: Thu Feb 28, 2008 1:23 pm
by horserider
What's ur target?

Posted: Thu Feb 28, 2008 1:31 pm
by dspxlearn
Hello Barbara,

Are you trying to display in the target as '0.00' (varchar datatype)?
If yes did you try this:

Code: Select all

Field(DecimalToString(STAGE_VARIABLE_NAME_HERE, 'fix_zero, suppress_zero'), '.', 1) 
          : '.' : Left(Field(DecimalToString(STAGE_VARIABLE_NAME_HERE, 'fix_zero'), '.', 2) : Str('0', 2) , 2) 
Let us know your results. :)

Posted: Thu Feb 28, 2008 1:32 pm
by dspxlearn
Hello Barbara,

Are you trying to display in the target as '0.00' (varchar datatype)?
If yes did you try this:

Code: Select all

Field(DecimalToString(STAGE_VARIABLE_NAME_HERE, 'fix_zero, suppress_zero'), '.', 1) 
          : '.' : Left(Field(DecimalToString(STAGE_VARIABLE_NAME_HERE, 'fix_zero'), '.', 2) : Str('0', 2) , 2) 
Let us know your results. :)

Posted: Thu Feb 28, 2008 2:20 pm
by ray.wurlod
Numeric data are stored in binary format, you can not affect their display. You need to convert to string to have any control over the display format.

Posted: Thu Feb 28, 2008 2:37 pm
by gmt_etldev
Thank you very much - that code worked! My target is a sequential file.
I really appreciate your help!
Thanks,
Barbara