on 09-01-2008 12:02 PM
Hi
from the source I am getting 50:US:9000
target I required only 50.(this is ok)
if the input comes 5:US:9000
target I required 05.
can you please any one send me udf for this
regards
venkat.
Hi,
Try with this udf
Use cache parameter context
public void extract1(String[] a,ResultList result,Container container)
{
String b[] = a[0].split(":");
if(b[0].length() >2)
result.addValue(b[0]);
else
result.addValue( "0" + b[0]);
}
Edited by: malini balasubramaniam on Sep 1, 2008 1:19 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
A small change in the condition
if(b[0].length() >= 2)
result.addValue(b[0]);
else
result.addValue( "0" + b[0]);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi venky,
create a simple udf with the cache type Value.
Code:
public String simple(String a,Container container)
{
String val=a.split(":")[0];
int l=val.length();
for(int i=0;i<2-l;i++) val="0"+val;
return val;
}
Regards,
Sankar Choudhury
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venky,
it can de done by using mapping functions ie. substring and concat function
target : 5:US:9000 sutstring value (01)
then u get only five
after that take a constant and give tha value as 0
then the req output will be 05
if found worth pls do the req
Regrads
Sampath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
guess it's also possible with standard functions:
If input length > Constant "0"
if indexOf (input; Constant ":") equalsS Constant "1"
then output = concat (Constant "0", input.substring(0, 1))
else output = input.substring(0,2)
Regards
Patrick
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.