AnsweredAssumed Answered

Query task does not return a feature

Question asked by esri1999 on May 9, 2013
Latest reply on May 10, 2013 by esri1999
Hi All,
I am having trouble with performing a query task on feature layer.Here is the workflow.
I have a menu item when clicked will perform query task returning all features in that layer and load into a Dojo combo box.
This spatial query is supposed to get all the features  but it is not loading a particular feature "ENG_XING = 340124F" .
When I perform exact query from map service REST end point ,I see this record.

"primaryMapUrl" is the REST end point URL which is ArcGISDynamic Layer. I am querying a feature layer under this.
The feature "ENG_XING = 340124F" is not returning from the query.
I cant figure out where I am going wrong .Please take a look at my code and help me resolve this.
Here is my existing code:

<div dojoType="dijit.MenuItem" iconClass="searchbycrossingIcon" class="menuItem"  onclick="loadDotXingNumber()">DOT XING#</div> function loadDotXingNumber(){   var layerId = getlayerIdByName("primary_dataset","Active Road Crossings");   var queryTask = new esri.tasks.QueryTask(primaryMapUrl + "/"+layerId);      var query = new esri.tasks.Query();      query.returnGeometry = false;      query.outFields = ["OBJECTID","ENG_XING"];        query.where = "1=1" ;      queryTask.execute(query,populateDotXingNumbers);  }  else{   dijit.byId('dotXingDialog').show();  } } function populateDotXingNumbers(results){  var dotxingnumbers = [];  for (var i=0; i<results.features.length; i++){     dotxingnumbers.push(results.features[i].attributes["ENG_XING"]);    if(results.features[i].attributes["ENG_XING"]=="340124F"){alert("Hurray!I find Xing");}  }  if (dotxingnumbers.length>0){   dotxingnumbers = removeDuplicateArrVal(dotxingnumbers);   dotxingnumbers.sort();   isDotdivLoaded=true;   var dotXingData = "";   for (var j=0; j<dotxingnumbers.length;j++){    dotXingData += "{name : \"" + dotxingnumbers[j] + "\"}";    if (j!=dotxingnumbers.length-1){     dotXingData += ",";    }    }   showDotXingNumbers(dotXingData);  } } function showDotXingNumbers(dotXingData) {    var dotxingnumbers = eval("new dojo.data.ItemFileReadStore({data: {identifier : \"name\", items : ["            + dotXingData +  "]}})");       var myDijit = new dijit.form.ComboBox({         id: "dotxingnumbers",         name: "name",         store : dotxingnumbers,         searchAttr: "name",         value:'',         promptMessage: dotXingEmptyText        });       dojo.byId("dotXing").appendChild(myDijit.domNode);       dijit.byId('dotXingDialog').show(); }

Outcomes