<?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: FeatureLayer selectFeatures issue on subsequent queries in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-issue-on-subsequent/m-p/529330#M49394</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IS&amp;nbsp; query.objectIds = [feature_id_string]; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; query.objectIds=[feature_objectid_string];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sumit&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Nov 2011 16:16:39 GMT</pubDate>
    <dc:creator>SumitSharma</dc:creator>
    <dc:date>2011-11-30T16:16:39Z</dc:date>
    <item>
      <title>FeatureLayer selectFeatures issue on subsequent queries</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-issue-on-subsequent/m-p/529329#M49393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm having an issue with the featureLayer.selectFeatures method in the API. I'm using v2.5 compact&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On the first query attempt, everything works fine:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Not using a "where" statement&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- objectIds set to valid value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- feature is successfully returned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, on subsequent queries (using the exact same code) here are my results:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- A "where" statement is added even though I didn't specify one, with the OBJECTID value from the first feature that I queried. It's almost as if the previous query result's OBJECTID is being cached.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Feature is not returned because the OBJECTID value is from the previous query, not from the new query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My query object (esri.tasks.Query) is scoped locally to the method, so I know it's not a global variable issue. But, for some reason, a "where" statement is added automatically when the HTTP request is made (verified by inspecting the request in Fiddler). I've even manually set the query.where statement = null but this has no effect. The where statement is added anyway. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've also manually created a where statement that includes the new OBJECTID value (instead of specifying in the query.ObjectIds param), but the HTTP request includes the value from the previous query anyway. Ex: "where OBJECTID = 1 and ID= 3 and OBJECTID=3. So, two OBJECTID values are added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my method's code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function searchForStructure(feature_object_ids) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var feature_objectid_string = feature_object_ids.join(",");
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outSpatialReference = { "wkid": 102100 };
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["*"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = null;
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.objectIds = [feature_id_string];
&amp;nbsp;&amp;nbsp;&amp;nbsp; structuresLayer.clearSelection();
&amp;nbsp;&amp;nbsp;&amp;nbsp; structuresLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone else noticed this behavior?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Nov 2011 17:23:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-issue-on-subsequent/m-p/529329#M49393</guid>
      <dc:creator>ChristopherJennings</dc:creator>
      <dc:date>2011-11-29T17:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer selectFeatures issue on subsequent queries</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-issue-on-subsequent/m-p/529330#M49394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IS&amp;nbsp; query.objectIds = [feature_id_string]; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;or &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; query.objectIds=[feature_objectid_string];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sumit&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 16:16:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-issue-on-subsequent/m-p/529330#M49394</guid>
      <dc:creator>SumitSharma</dc:creator>
      <dc:date>2011-11-30T16:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer selectFeatures issue on subsequent queries</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-issue-on-subsequent/m-p/529331#M49395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, that was a typo when I transferred the code to the post.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It should read:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;query.objectIds=[feature_objectid_string];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My main concern is that a "where" clause is added with the previous search's OBJECTID even though I'm not specifying a "where" clause.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 15:00:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-issue-on-subsequent/m-p/529331#M49395</guid>
      <dc:creator>ChristopherJennings</dc:creator>
      <dc:date>2011-12-01T15:00:38Z</dc:date>
    </item>
  </channel>
</rss>

