If this is related to your other task, I will suggest this:
First, reset all arrays returned by AI Query before you use the Query action again. The action doesn't reset arrays for you. For example, if 5 elements are returned in the first run, and 3 elements are returned in the 2nd run, you will still see 5 elements in the second run, 3 from the 2nd run and 2 left behind from the 1st.
Second, check the Continue after Error option in the Query action. If the action doesn't return anything, %errmssg will show "timeout" and you will know the action failed.
And to answer your question above if it is not related to your task, you can simply do a %arr(%num) ISN'T SET.