on 06-20-2007 4:02 PM
Hi experts,
I am trying to map a string field to another using following mapping logic:
if source field ends with "_" and any substring, just pass the substring.
for example: if source field is "Custumer_name", pass "name" to the destination field
if source field is "Java_class", pass "class" to the destination field
any idea how to do this with XI built in functions or java mapping?
thanks
Why do we complicate code....when its so easy..indexOf is not even needed here......
String function, Substring function, use a string.split("_"), that will split the string at the _ character and give you the result.............
Like i said imam....if you need simple code, just lemme know
Regards
Ravi Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use this
int index = a.indexOf('_');
int len =a.length();
if( index == -1)
{
return ""a"";
}
else
{
String ret = a.substring(index+1,len);
return ""ret"";
}
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Imam,
You need to write a user defined funciton for this. Create a <b>Value</b> user defined function and name it as <b>GetValue</b>. Take one parameter 'a'.
Add this code:
int k = a.length();
int i = a.indexOf(".");
i = i +1;
a = a.substring(i,k);
return(a);
So it returns the value after -.
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Imam,
This is pretty easy to do with java mapping....
try splitting the string with a delimiter...and if this is not clear with java,
let me know and i can write the code you need..
Regards
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Write a user defined function. We cannot achive this by using builtin function.
Juct check the string in user defind function and when encounters _ pass the value.
regards
Hemant
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.