on 07-21-2009 1:10 PM
Hi,
I have one requirement in mapping.
One of my input field length is 8 and i need to maintain some conditions here.
If the incoming field comes 4 digits then i need to add 4 zeroes before to that field and send to target.
for eg., inut field : 1234 then target should be : 00001234
If the field is coming morethan 8 digits then it should read last 8 digits
for eg., inut field : 123456789 then target should be : 23456789
Please help me how can i maintain this.
Kind Regards,
Y.Raj.
Please use the following udf for your requirement
function myudf(String a, Container container)
{
int len = a.length();
String resut="";
if (len < 8)
{
int sub = 8 - len;
for (int i=0;i< sub;i++)
result=result+"0";
result=result+a;
}
else
{
result=a.substring(len-8,len);
}
return result;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You can write the UDF ,
Regards,
B.Jude
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.