Page 1 of 1

Decimal field suppressing leading and trailing zeros.

Posted: Fri Mar 12, 2010 1:17 pm
by vijayrc
Hi,

Working on DS after a while and finding it tough to achieve this result.
I have a source & destination field Decimal 15,2
When the amount field is zero, I should have 0.00
When the amount field is 12cents, I should have 0.12
When the amoutn field is 5dollars, I should have 5.00

In the abvoe scenarios, I 'm getting .00, .12 and 5.00 [only the last one is working]

How do I acheive this in Transformer.
These are my 4 stage variables
[1] StgIncSign:
If Lnk_Ntr_Final.FSSI_INCT_AMT[1,1] = "-" Then "Y" Else "N"
[2] StgIncTot
If StgIncSign = "Y"
Then "-" : Trim(Convert(" -","00",Lnk_Ntr_Final.FSSI_INCT_AMT),"0","L")
Else Trim(Convert(" -","00",Lnk_Ntr_Final.FSSI_INCT_AMT),"0","L")
[3] StgIncTotal
StgIncTot : StgSpace
[4] StgIncCount
Space(StgIncCount) : StgIncTot
Final field derivaiton: Space(StgIncCount) : StgIncTot

Posted: Fri Mar 12, 2010 1:47 pm
by ray.wurlod
.00 and .12 are correct. With Decimal data type you can not affect the format (it's actually stored internally in binary format). If you convert it to a string data type of some kind then you can affect the format, as you seem to be trying to do.

You are discarding the sign character ("-"). Do you mean to do so?