AnsweredAssumed Answered

Query Question

Question asked by DanielTrone on Jun 26, 2013
Latest reply on Jun 26, 2013 by DanielTrone
Hopefully I am overlooking something really simple. Can anyone tell me what I'm doing wrong?

I'm trying to only get a couple of fields from my query. ( query.outFields=["COUNTY","Y2040_E"]; )

Instead I get all fields.


<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
  <title>Test Query</title>

  <script>var dojoConfig = { parseOnLoad:true };</script>
  <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/"></script>
  <script>
    dojo.require("esri.layers.FeatureLayer");
dojo.require("esri.tasks.query");

    var featureLayer;


    dojo.ready(init);

function init(){
      featureLayer = new esri.layers.FeatureLayer("http://services.arcgis.com/IamIM3RJ5xHykalK/arcgis/rest/services/Components_of_Change/FeatureServer/0", {
        outFields:["*"]
      });

      featureLayer.on("load", function () {

   var query = new esri.tasks.Query();
      query.where = "COUNTY != 'Blank'" ;
   query.outFields=["COUNTY","Y2040_E"];
   query.returnGeometry=false;

  

     featureLayer.queryFeatures(query,function(featureSet){
 
     var items = dojo.map(featureSet.features,function(feature){
         return feature.attributes;
     });
 
      }); //end featurelayer queryfeatures
  
   }); //end featurelayer onload
  
} //end init

</script>
</head>

<body>
<p>Check firebug response for fields returned.</p>
</body>

</html>

Outcomes