Page 1 of 1
adding zero into input field's data
Posted: Tue Apr 22, 2014 9:56 am
by ravikumarav
input:
_____
Qty
2
75
1275
125
i need output like below:
-----------------------------
Qty
0002
0075
1275
0125
i have tried like below to achieve the above result
Right(Str("0",4):Qty,4)--- using trasformer stage
Could please help me any one for the above..
Thanks,
Ravi.
Posted: Tue Apr 22, 2014 10:17 am
by chulett
What output do you actually get? What is the data type of your target column?
Posted: Tue Apr 22, 2014 10:52 am
by chulett
Posted: Tue Apr 22, 2014 12:27 pm
by yugee
You can try below:
InputField:Str('0', 4 - len(InputField))
InputField -- is your input field
4 - length if your output column after padding the leading zeroes
--this will not work if you have declared output field as numeric.
Posted: Tue Apr 22, 2014 2:35 pm
by ray.wurlod
The expression you used will work fine, provided that the target column data type is string (that is, Char or VarChar).
Reply
Posted: Thu Apr 24, 2014 6:38 pm
by ssnegi
Since you want 0 before the input value :
str('0',4-len(DSLink.COL)):DSLink.COL
Re: Reply
Posted: Fri Apr 25, 2014 4:29 pm
by ray.wurlod
ssnegi wrote:Since you want 0 before the input value :
str('0',4-len(DSLink.COL)):DSLink.COL
... which is exactly the expression that the original poster used.