<?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 FeatureLayer.selectFeatures does not work when using a where clause in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614484#M57467</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to select features from a feature layer using a query with a where clause. It returns the correct features, but does not draw them. When I do the same thing but use a query with the geometry property set to a polygon, the correct features are returned AND drawn on the map. How do I get this to draw the feature layer when using a where clause with the query?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureLayer = new esri.layers.FeatureLayer(arcGisServerUrl + "/" + serviceLayerId, {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_SELECTION,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields: ["*"],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id: featureLayerName
&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["*"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = "1=1";

&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, HandleRouteSelectFeaturesResults);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jul 2013 17:16:58 GMT</pubDate>
    <dc:creator>RobertMetzger</dc:creator>
    <dc:date>2013-07-25T17:16:58Z</dc:date>
    <item>
      <title>FeatureLayer.selectFeatures does not work when using a where clause</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614484#M57467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to select features from a feature layer using a query with a where clause. It returns the correct features, but does not draw them. When I do the same thing but use a query with the geometry property set to a polygon, the correct features are returned AND drawn on the map. How do I get this to draw the feature layer when using a where clause with the query?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureLayer = new esri.layers.FeatureLayer(arcGisServerUrl + "/" + serviceLayerId, {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_SELECTION,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields: ["*"],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id: featureLayerName
&amp;nbsp;&amp;nbsp;&amp;nbsp; });

&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["*"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = "1=1";

&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, HandleRouteSelectFeaturesResults);
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jul 2013 17:16:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614484#M57467</guid>
      <dc:creator>RobertMetzger</dc:creator>
      <dc:date>2013-07-25T17:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.selectFeatures does not work when using a where clause</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614485#M57468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rob,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's strange where and geometry both return features but only geometry derived results draw. Seems like something might be up with your callback function. Try adding a an errback function to see if something is up. This will not only show errors from the server, but will also expose processing errors in the callback function which will otherwise not be logged in the console.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;featureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, HandleRouteSelectFeaturesResults, errorFunction);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function errorFunction(error) {
&amp;nbsp; console.log(error)
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, here's a list of mix ins for esri.layers.FeatureLayer modes. Saves quite a bit of space. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
featureLayer.selectFeatures(query, 3, callback, errback);

//feature layer modes
//MODE_SNAPSHOT:0
//MODE_ONDEMAND:1
//MODE_SELECTION:2
//SELECTION_NEW:3
//SELECTION_ADD:4
//SELECTION_SUBTRACT:5
//POPUP_NONE:"esriServerHTMLPopupTypeNone"
//POPUP_HTML_TEXT:"esriServerHTMLPopupTypeAsHTMLText"
//POPUP_URL:"esriServerHTMLPopupTypeAsURL"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:17:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614485#M57468</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2021-12-12T02:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.selectFeatures does not work when using a where clause</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614486#M57469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hmm...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This might be similar to the problem I've been having as outlined in this &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/89091-setSelectionSymbol-doesn-t-work-first-time..."&gt;thread&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe it does have something to do with the where clause.&amp;nbsp; Any thoughts from the ESRI folks?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ken&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jul 2013 21:35:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614486#M57469</guid>
      <dc:creator>KenMorefield</dc:creator>
      <dc:date>2013-07-25T21:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.selectFeatures does not work when using a where clause</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614487#M57470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;Try adding a an errback function to see if something is up. This will not only show errors from the server, but will also expose processing errors in the callback function which will otherwise not be logged in the console.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion. I added an error callback function but it never gets called.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 13:05:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614487#M57470</guid>
      <dc:creator>RobertMetzger</dc:creator>
      <dc:date>2013-07-26T13:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.selectFeatures does not work when using a where clause</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614488#M57471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I ran a quick test and selecting features using a where clause worked for me. Here's a jsFiddle showing the code: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://jsfiddle.net/7ukqS/"&gt;http://jsfiddle.net/7ukqS/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 14:56:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614488#M57471</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2013-07-26T14:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureLayer.selectFeatures does not work when using a where clause</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614489#M57472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I ran a quick test and selecting features using a where clause worked for me. Here's a jsFiddle showing the code: &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://jsfiddle.net/7ukqS/"&gt;http://jsfiddle.net/7ukqS/&lt;/A&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I used the feature layer URL from your example and my code worked. There must be something wrong with my service when using a where clause. I'll have to check with the person who made the service to make sure it is returning the correct data. It always returns the correct features, but there might be something subtly wrong with the geometry. Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 15:48:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-selectfeatures-does-not-work-when/m-p/614489#M57472</guid>
      <dc:creator>RobertMetzger</dc:creator>
      <dc:date>2013-07-26T15:48:31Z</dc:date>
    </item>
  </channel>
</rss>

