on 12-20-2006 12:10 PM
Hi
I have a UDF which does the split operation and returns the first string. My source field has the value <b>Ground Floor - Entry</b>. The split happens at '-' and the string returned is "Ground Floor". If my source value is separated by comma or any special characters other than '-' the UDF will go for an error. Can i have some global containers which will have the value '-' and this container can be used in my udf function. In furture if my separator is changed i can just change the container value rather than the UDF.
the udf has the following code:
String a[] = REC_DAT.split("-");
return a[0];
My requirement is to replace the character "-" in the split function with some global containers.
Kindly let me know on how to achieve this.
Regards
Prabhu
Hi Prabhu,
create one more input for your udf and use it as the split value, then assign the constant '-' to that input.
I think you do not need to use global container for this substitution.
Hope it helps,
Regards,
Sergio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could also perform a loop that checks for the other possible delimiters, such as:
String temp[] = REC_DAT;
for(int i = 0; i < temp.length; i++) {
if(temp<i> == "," | " " | etc)
temp<i> == "-";
}
String a[] = REC_DAT.split("-");
return a[0];
There are most definitely some syntax errors in there, but hopefully you can see the logic behind it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thkx Sudharshan. Solved.
Sergio, I was wondering if there is some waay of achiving other than the container variable. Thnkx for your input also.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this blog for global variables
<a href="/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14:///people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
Regards,
Sudharshan
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.