Hi all!I have been trying to send dozens of queries to retrieve data points with different parameters. I can't figure out how to tell which response came from which query. The exact number of queries will be unknown, but it will most likely be 100+. I can't see creating over 100 named functions to callback, and I can't figure out how to get external information into a shared callback or anonymous inline function. As I loop through the array containing the data that will make up the queries, I have an index. If I use the index value within an inline function, by the time the callback function is called, the index is always max.
for(var i = 0; i < queryArray.length; i++) {
queryTask.execute(query, function(featureSet) {
...
alert("Query Task #" + i);
});
}
If queryArray.length = 25, I get 25 alert windows with "Query Task #24".Does anybody know how to know which response corresponds to which request?Thanks!