cancel
Showing results for 
Search instead for 
Did you mean: 

Help in UDF and global containers

prabhu_s2
Active Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Answers (3)

Answers (3)

Former Member
0 Kudos

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.

prabhu_s2
Active Contributor
0 Kudos

Thkx Sudharshan. Solved.

Sergio, I was wondering if there is some waay of achiving other than the container variable. Thnkx for your input also.

Former Member
0 Kudos

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