Decimal field suppressing leading and trailing zeros.
Posted: Fri Mar 12, 2010 1:17 pm
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
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