on ‎2021 Nov 21 1:44 PM
Hello experts
Ive the following requirement, please suggest how to achieve/solve this...
Ive this UDF where I replace 0 with other values in a context:
This is my UDF

int flag,count=0;
for(int i=0;i<POSNR.length;i++)
{
flag=0;
for(int j=0;j<POSNR1.length;j++)
{
if(POSNR[i].equals("0"))
{
result.addValue(POSNR1[count]);
count++;
flag=1;
break;
}
}
if(flag==0)
result.addValue(POSNR[i]);
}<br>
It works also fine these two inputs and the result is like this:

But when I have these two input (multiple 0's) then I get this Error:

Exception:[java.lang.ArrayIndexOutOfBoundsException: while trying to load from index 1 of an object array with length 1, loaded from the second parameter of the method]
In this case it also should continue and give the values through...
Can you tell me please how to achieve this?
Thank you in advance!
Request clarification before answering.
Hi,
You are getting this error because the no.of zeros in first queue is not equal to no.of input in second queue.
In first case you have given 2 zeros in first queue and no.of input in second queue is also 2. This is why it is getting executed successfully.
Thanks,
Aamir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.