evtguy

Previous project query code won't work now

Discussion created by evtguy on Dec 21, 2012
Latest reply on Dec 22, 2012 by evtguy
So here's a weird one. I have a little function to zoom to the extent of a point feature based on the ID provided to the function. In it's original form, the function took the FID as the passed parameter like so:

 function zoomPointRow(id){
  thePointLayer.clearSelection();
  var query = new esri.tasks.Query();
  query.objectIds = [id];
  thePointLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW,function(features){
     var thePoint = features[0].geometry;
  var theExtent = pointToExtent(map,thePoint,10);
  map.setExtent(theExtent);
  });
 };


This works fine and worked fine with my current project until I had to change things slightly. In my new project, I'm trying to use this function with a featureLayer that I build on the fly when the map loads (like if you were importing a JSON feed, etc). Instead of using FID, I decided to just alter the query to search for an attribute value associated with the feature like this:

function zoomRow(id){
  theFeatureLayer.clearSelection();
  var query = new esri.tasks.Query();
  query.where = "SENSORID=" + id;
  theFeatureLayer.queryFeatures(query,function(features){
     gagePoint = features[0].geometry;
  theExtent = pointToExtent(map,gagePoint,10);
  map.setExtent(theExtent);
  });
 };


The function is called from the onClick event of an HTML <a> tag. Now, when I click my link to fire off the function, I get the following error in the console: "Error: FeatureLayer::_query - query contains one or more unsupported parameters
http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/esri/layers/FeatureLayer.xd.js
Line 19"

It can't get any more simpler than this so what gives? Unfortunately, the app in development is not on the public side of the firewall..

Thanks!
Steve

[EDIT] I should say that I changed the code from selectFeatures to queryFeatures in attempts to try different things. Both methods return the same error.

Outcomes