xupla

Get the outFields of a selected polygon in a feature Layer

Discussion created by xupla on Apr 16, 2014
Latest reply on Apr 16, 2014 by JGravois-esristaff
I want to get the outfields of a selected polygon. Rather than using the infoTemplate; I want to store the outFields in a variable. How can I do this please?

I have done a query on the feature layer, but the result given is all the polygons next to the polygons selected.

localCouncilsLayer.on("click", function (evt) {
 var query = new Query();
 var queryTask = new QueryTask("feautre layer");
 query.geometry = evt.graphic.geometry;
 query.returnGeometry = true;
 query.outSpatialReference = map.spatialReference;
 query.outFields = ["*"];
 queryTask.execute(query, function (results) {  
  var selectionAreaCity = results.features[0].attributes["NAME"]
 });
});

Outcomes