cancel
Showing results for 
Search instead for 
Did you mean: 

Simple UDF

Former Member
0 Kudos

Hi,

I need some help on Java UDF.

I need a udf which accepts two values (One is queue and another is a string)

My UDF should search the string in the queue and return 'Y' if found or 'N' if not found.

Please help on this!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Krish,

That is not possible, what you have to do is take it two Queues (array), in the second array just take the arr2[0] then it acts as a string.

ex: If you want to check the each array (queue) element with second array (in your case String) then use like this

for(int i =0; i<arr1.length; i++)

{

if(arr1<i>.equals(arr2[0]))

return 'Y';

break;

}

return 'N';

Regards

Ramesh

Answers (1)

Answers (1)

GabrielSagaya
Active Contributor
0 Kudos

Please use the below advanced UDF to search the string in the queue and return 'Y' if found or 'N' if not found

function void myudf(String var1[[ ]], String var2[[ ]], ResultList result, Container container)

{

int flag=0;

for (int i=0;i<var1.length;i++)

if (var1[<i>].equals(var2[[0]]))

flag=1;

if (flag==1)

result.addValues("Y");

else

result.addValues("N");

}