on 12-01-2010 7:26 AM
Friends,
Please let me know how can i add leading number Zero in mapping
For Example:
Source : 123
Target : 0123 (NEED TO GET).
ANY HELP ON THIS.
Thanks in advance,
Hi
You can use the function "FormatNum" to add leading zeros.
Thanks
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
As other threads mentioned used FormatNum and double click and put Zeros. Like if the lenght is 10 then put 10 zeros. Here one thing you should analyse is, if your input value has a string value it will fail in FormatNum becuase it expects only the numeric value.
So if you dont know whether your input has numeric or alphanumeric then go to UDF. So create a udf with name AddZeros and as Value with one argument as input.
Imports: java.*;
Then add this code:
int len=input.length();
for(int i=0; i<10-len;i++)
{
input="0"+input;
}
return input;
Here I am assuming the total length is 10. If yours is 20 then put 20 instead of 10 in the second line of the code.
Rgds
Pothana
Hi,
You can go ahead with the standard function " Formatnum", else you need to write a UDF to add a leading zero.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.