Query Loop

Discussion created by songissimo on Feb 28, 2012
Latest reply on Mar 5, 2012 by stevengriffith
Hi everybody,
    I need to run a loop inside where I run some query (queryTask.execute(...)) on a Feature Layer.
As you know, queries run in rapid sequence may terminate in different order then the original. A possible solution I found is to use a callback function that add the results (everytime is called) to a global array and at the end we can find those results in that array. But at this point I get an issue, I don't know exactly when all the queries are terminated, so I can't actually use the queries' results.
I tried to use dojo.connect(...) to connect the onComplete event of every query run to the function that add the results to the global array but this doesn't work properly and furthermore I still don't know when exactly all the queries terminate.

Have you got any idea?have someone ever got this issue?

Thank you everybody.