on 02-21-2012 9:42 AM
Hi,
I have a requiremnt to map a field called source_code to area_code.
The source_code can have values like below:
Case 1 20,abc
Case 2 ,abc
Case 3 2,abc
Now i need values which are before comma in the area_code (target).
So,it means here i need to take comma as delimiter.
Also, in case 1, i need to send 20
in case 2, i need to send blank constant or null value, and
in case 3, i need to send 2.
Can somebody help me with this eitehr using Graphical mapping or UDF.
Hi,
You can use a single-line UDF:
return input.substring(0,input.indexOf(","));
with a single input parameter "input" of type string and Execution Type: Single Values.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
chk this code:
input will be "a"
Execution type: all values of a context
for(int j=0;j<a.length;j++)
{
String [] var=a[j].split(",");
result.addValue(var[0]);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try with this simple UDF..You can also split the input string at comma and return the value.
int var1=0;
var1 = input.indexOf(',');
return input.subString(0,var1-1);
Regards,
Priyanka
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 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.