cancel
Showing results for 
Search instead for 
Did you mean: 

does UDF reqd to multiply by 10 and add leading zeros to make length 5

Former Member
0 Kudos

Hi,

I have a Target field PO_ITEM where i need to pass the value always of length 5

suppose if the input field is 2 digit(45), so i need to multiply this with 10 and add leading zeros (2) in this case to make it length 5, 00450. can i do this using graphical mapping, or UDF is required. If UDF is needed, can anyone pls provide the same.

Thanks & Regards,

Varun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Reddy,

First we have to check the input length, if this length is less than 5 then only we can multiply this value by using 10 later we can add zeros.

This should be possible using Graphical mapping.

Here you can use if (if with else) statement.

if (input_value.length > 4) then send the input_value as it is to the target field.

else input_value multiply 10 FormatNum(00000) then pass to the target field.

Regards

Ramesh

Answers (3)

Answers (3)

varun_k
Contributor
0 Kudos

Hii...

Thanks Ramesh for your reply. I have done the same thing, and its fine.

Ihad dne this using Graphical mapping.

First I had checked input length, if this length is less than 5 then only I had multiplied this value by 10 later I had used FormatNum(00000) wih 5 zeros then pass to the target field.

This should be possible using

Thanks everyone for your time.

Regards,

Varun

Former Member
0 Kudos

Hi Varun,

I would do the following:

Input -> MapWithDefault(1) -> multiply(10) -> FormatNum(00000)

The above should do the trick without UDF.

Edited by: Christian Vilhelm Henriksen on Feb 22, 2010 3:53 PM

You can leave out the MapWithDefault, its only to secure mapping wont fail if input is empty.

former_member200962
Active Contributor
0 Kudos

You need to make use of an UDF for this requirement...you can find some lead from this thread:

Regards,

Abhishek.