I am using the QueryTask.execute call to do some queries against some map service layers. The response to the callback function is a feature set. Currently, I am making my QueryTask calls in a synchronous fashion is that I wait until a QueryTask request is completed before making another request to the next map layer. I was doing this so that I could keep track of which feature set went with which layer. I want to be able to run the QueryTask requests asynchronously, however, so that all the results come back much faster. In that case, I am just in a loop for each layer I want to query and submit a QueryTask. The loop has completed before any of the features sets are returned. The problem is that when I am in the callback function with the feature set response, I can't tell which layer the feature set results are for. I can't set any local variables because those variable values will change before they can be appropriately used. I tried looking at the various feature set properties but could not find anything that would tell me which layer was queried.
Does anyone have insight into whether I can obtain the layer name / url that was used in the QueryTask withi the callback function once the Query Task has completed?
Thanks - Peter