<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Previous project query code won't work now in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/previous-project-query-code-won-t-work-now/m-p/322484#M29691</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sounds like you are creating a feature collection based feature layer? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#FeatureLayerConst2"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#FeatureLayerConst2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is the case queries with a where clause aren't supported. There are a few more things to be aware of - see the following list from the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edits are applied on the client not posted to the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The feature layer generates a unique object id for new features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does not support queries that need to be performed on the server, e.g. queries with a where clause or non-extent based spatial queries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The feature layer toJson method returns an object with the same properties as the feature collection. The returned object includes all the features that are in the layer when the method is called. This method can be used to access a serializable representation of the features that can be saved on the server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Dec 2012 23:40:26 GMT</pubDate>
    <dc:creator>KellyHutchins</dc:creator>
    <dc:date>2012-12-21T23:40:26Z</dc:date>
    <item>
      <title>Previous project query code won't work now</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/previous-project-query-code-won-t-work-now/m-p/322483#M29690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; function zoomPointRow(id){
&amp;nbsp; thePointLayer.clearSelection();
&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp; query.objectIds = [id];
&amp;nbsp; thePointLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW,function(features){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var thePoint = features[0].geometry;
&amp;nbsp; var theExtent = pointToExtent(map,thePoint,10);
&amp;nbsp; map.setExtent(theExtent);
&amp;nbsp; });
 };&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function zoomRow(id){
&amp;nbsp; theFeatureLayer.clearSelection();
&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp; query.where = "SENSORID=" + id;
&amp;nbsp; theFeatureLayer.queryFeatures(query,function(features){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gagePoint = features[0].geometry;
&amp;nbsp; theExtent = pointToExtent(map,gagePoint,10);
&amp;nbsp; map.setExtent(theExtent);
&amp;nbsp; });
 };&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The function is called from the onClick event of an HTML &amp;lt;a&amp;gt; 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&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/esri/layers/FeatureLayer.xd.js" rel="nofollow noopener noreferrer" target="_blank"&gt;http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/esri/layers/FeatureLayer.xd.js&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Line 19"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;[EDIT]&lt;/STRONG&gt;&lt;SPAN&gt; I should say that I changed the code from selectFeatures to queryFeatures in attempts to try different things. Both methods return the same error.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:18:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/previous-project-query-code-won-t-work-now/m-p/322483#M29690</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2021-12-11T15:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Previous project query code won't work now</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/previous-project-query-code-won-t-work-now/m-p/322484#M29691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sounds like you are creating a feature collection based feature layer? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#FeatureLayerConst2"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#FeatureLayerConst2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If this is the case queries with a where clause aren't supported. There are a few more things to be aware of - see the following list from the help:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edits are applied on the client not posted to the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The feature layer generates a unique object id for new features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does not support queries that need to be performed on the server, e.g. queries with a where clause or non-extent based spatial queries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The feature layer toJson method returns an object with the same properties as the feature collection. The returned object includes all the features that are in the layer when the method is called. This method can be used to access a serializable representation of the features that can be saved on the server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 23:40:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/previous-project-query-code-won-t-work-now/m-p/322484#M29691</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2012-12-21T23:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Previous project query code won't work now</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/previous-project-query-code-won-t-work-now/m-p/322485#M29692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Kelly,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes- you are correct- it is a layer based on a feature collection. I missed that note in the API reference. So do I have any other options for querying my layer besides objectId?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my app, the feature collection gets replaced every 5 minutes after a new query to a database so I don't think I can use objectIDs as a viable query tool. I only have 8-12 features (they're stream gages) so I can just loop through the features but I'm just curious what to do if your feature collection has a lot more features in it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 23 Dec 2012 02:49:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/previous-project-query-code-won-t-work-now/m-p/322485#M29692</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2012-12-23T02:49:37Z</dc:date>
    </item>
  </channel>
</rss>

