on 05-24-2010 4:05 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
61 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.