on 03-07-2014 12:40 PM
Hi experts
my requirement is one source field is split in to two fields
the source field is not fixed..
ex :
1)Source field : FLE-BPO
Target filed 1 : FLE
Target filed 2 : BPO
2)
Source field : FLE-FEAO
Target filed 1 : FLE
Target filed 2 : FEAO
plese tell me how to solve this .......
1) suppose fixed length what is the solution?
2) suppose length is vary what is the solution?
Thanks & Regards
E. Ravi Chandra Reddy
Hi Ravi,
in simple create two udf.
1.getting first string :
String[] output = new String[2];
output = var1.split("-");
return output[0];
2. getting first string :
String[] output = new String[2];
output = var1.split("-");
return output[1];
you can also think of putting exception handling in this part.
Regards,
Muni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
You can simply Split the string by using below code;
data : v_str type char50.
v_str = 'FLE-FEAO'.
split v_str at '-' into a b.
write 😕 a.
write : /b.
Please try in this way.
-Regards
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
you can use the below code to create generic UDF.
you need to take two input input field and index. Index is 1 for first value and 2 for second value. you can take any no of values.
If you gave index 2 and delimeter "-" is not present then UDF pass blank value.
String[] output = input.split("-");
int num = Integer.parseInt(index);
if (output.length>num-1)
{
return output[num-1];
}
return "";
mapping screenshot
regards,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you know the field length ... I mean if you know the "-" specified location then you can get it from substring...
Otherwise Please follow the UDF Suggested By Muni...
Thanks,
Sreenivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.