on 06-18-2010 8:44 AM
Hi,
In the mapping Source field has the value XXX_YY_ZZ. I need XXX in target field1, YY in target field2 & ZZ in target field3.
Kindly suggest if any standard function s available or how to go about this.
eg
source abcd_abc_asdff
target field1 - abcd
target filed2 - abc
target field3 - asdff
Thanks in advance
If your source format standard then use substring function,if the length is going to vary then use sunil UDF.
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 create 3 UDF as shown below:
public String getStr1(String input, Container container)
{
String arr[] = input.split("_");
return arr[0]; // for other 2 string use arr[1] and arr[2]
}
or create ony one UDF with index also as a input.
Regards,
Sunil Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adding to sunil's comment..
you can include one more parameter for index.. to avoid separate UDF for each fields.
public String getStr1(String input, Container container)
Parameters: input, indexVal
String arr[] = input.split("_");
return arr[indexVal]; // for other 2 string use arr[1] and arr[2]
Mapping
Source + Constant (0 or 1 0r 2) -- > UDF -- > Target
Regards
Ramg
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.