cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Zeros infront of a field in Message Mapping

Former Member
0 Kudos

Hi,

I need to add zeros infront of my target field (eg Target Field length is fixed (10). If incoming field is having only 3 digits (123), I need to add 7 (10-3) zeros infront of my target field (0000000123). How to go about it. Is there any standard functions to do this ?

Thanks in advance,

Jose Augastine

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Jose

We have a Arithmetic Function that will do this for you

GoTo the MappingEditor->Select the ArithmeticFunction (FormatNumber)and connect ur source and Taget Fields.

DoubleClick the "FormatNumber" function and write 0000000000 in the NumberFormat space. U can also DecimalSeperator in the second option (if required).

Enjoy Mapping

Dhanya

Former Member
0 Kudos

Try using this UDF

double d = Double.parseDouble(a);

DecimalFormat df=new DecimalFormat("0000000000");

StringBuffer sb=new StringBuffer();

df.format(d,sb,new

FieldPosition(NumberFormat.INTEGER_FIELD));

return(sb.toString());

Regards,

Jai Shankar.

Message was edited by: Jai Shankar

Former Member
0 Kudos

Hi,

There is no 1 function, but you can use a combination of "text" functions to accomplish this, e.g. length, concat, substring.

Or, you can write a simple user-defined function to do the same.

Regards,

Bill

Former Member
0 Kudos

Jose,

You have a function FormatNum in Airthemtic funciton. You add 10 Zeros with it. Then you will get the required output.

Field1>FormatNum(10Zeros)>Target

Ex:

123-->0000000123

---Satish