Multiple identify task & dojo deferredlist

635
1
07-12-2011 09:29 AM
KomalFernandes
New Contributor
I am trying to identify data from multiple map service and then merge in single array for further processing. The identify task works but when defCntyTask.addCallback is executed response.length return Undefined and nothing executes further.

I have tried to follow this post http://forums.esri.com/Thread.asp?c=158&f=2396&t=295896&mc=6#msgid924290

Can someone suggest how to correct this. Below is the code I used

Thanks

===

var defCntyTask = new dojo.Deferred();
var defwellTask = new dojo.Deferred();
var defpropTask = new dojo.Deferred();

functon createMapParam(evt)
{
CntyParam.tolerance = 5;
wellParam.tolerance = 5;
propParam.tolerance = 5;
CntyParam.returnGeometry = true;
wellParam.returnGeometry = true;
propParam.returnGeometry = true;
CntyParam.layerIds = [2];
wellParam.layerIds = [5];
propParam.layerIds = [5];
CntyParam.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
wellParam.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
propParam.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
map.graphics.clear();
CntyParam.geometry = evt.mapPoint;
wellParam.geometry = evt.mapPoint;
propParam.geometry = evt.mapPoint;
CntyParam.mapExtent = map.extent;
wellParam.mapExtent = map.extent;
propParam.mapExtent = map.extent;
}

function mspIdTask(evt)
{
defCntyTask = cntyIdTask.execute(CntyParam);
defwellTask = stnIdTask.execute(wellParam);
defpropTask = stnIdTask.execute(propParam);

defCntyTask.addCallback(function(response){console.log("Completed County Id task " + response.length);});
defwellTask.addCallback(function(response){console.log("Complete Well Id task " + response.length);});
defpropTask.addCallback(function(response){console.log("Complete Property Id task " + response.length);});

var defIdList = new dojo.DeferredList([defCntyTask,defwellTask,defpropTask]);

var idTaskComplete = function()
{
  Console.log("All Id task complete, Call merge results process ");
}

myDefIdList.addCallback(idTaskComplete);
}
0 Kudos
1 Reply
JohnGrayson
Esri Regular Contributor
I believe the Identify results can not be used with dojo.DeferredList(...).  You could look at the 'Identify' related items on the 'Web Application Templates' group on ArcGIS.com  (link) that have similar behavior.  There's a lot of extra stuff in the code you probably don't need, but it shows a general pattern of how this could be done.
0 Kudos