I am trying to get the results of an identify task using ArcGIS JS API 2.7 into a featureSet so I can utilize this sample http://arcscripts.esri.com/details.asp?dbid=16528 that takes the results of a datagrid store and exports them to an excel file. I have it working where one feature is being exported, I just need to have all selected features export. Does an Identify Task produce a FeatureSet?
Thanks!
function executeIdentifyTask(geom) {
//clear the graphics layer
map.graphics.clear();
identifyParams.geometry = geom;
identifyParams.mapExtent = map.extent;
identifyTask.execute(identifyParams,function(response){
var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DOT, new dojo.Color([151, 249,0,.80]), 3), new dojo.Color([151, 249, 0, 0.45]));
var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 20, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 1), new dojo.Color([25,50,225,0.3]));
var controlItems = [];
var surveyItems = [];
dojo.forEach(response,function(result){
var feature = result.feature;
if (result.layerName =="surveys"){
showSurveysNameGrid();
feature.setSymbol(polygonSymbol);
searchType="selSurvey";
surveyItems.push(attributes);
var attributes = feature.attributes;
var csvTextSurv = "DOCUMENT_N;TOWNSHIP_RANGE;SECTION\n";
csvTextSurv += attributes["DOCUMENT_N"] + ";" +
attributes["TOWNSHIP_RANGE"] + ";" +
attributes["SECTION"] + "\n";
document.getElementById("csvSurv").value = csvTextSurv;
map.graphics.add(feature);
}else{
showPointNameGrid();
feature.setSymbol(markerSymbol);
var attributes = feature.attributes;
controlItems.push(feature.attributes);
searchType="selControl";
var csvTextMons = "POINT_NAME;SECTION\n";
csvTextMons += attributes["POINT_NAME"] + ";" +
attributes["TOWNSHIP_RANGE"] + ";" +
attributes["SECTION"] + "\n";
}
document.getElementById("csvMons").value = csvTextMons;
//add selected feature to graphics layer
map.graphics.add(feature);
});
if(surveyItems.length >0){
showSurveysNameGrid();
var surveysStore = new dojo.data.ItemFileReadStore({data: {identifier:'DOCUMENT_N',items:surveyItems}});
var grid = dijit.byId('grid5');
grid.setStore(surveysStore);
}
if(controlItems.length >0){
showPointNameGrid();
var controlStore = new dojo.data.ItemFileReadStore({data:{identifier:'POINT_NAME',items:controlItems}});
var grid = dijit.byId('grid4');
grid.setStore(controlStore);
}
});
}