<?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 queryFeatures does not return if query has no results in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/queryfeatures-does-not-return-if-query-has-no/m-p/546400#M50914</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;featureLayer.queryFeatures appears to not execute the callback if there are no features that match the query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have modified the following sample to illustrate (JS API 3.8):&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://developers.arcgis.com/en/javascript/samples/fl_paging/" rel="nofollow" target="_blank"&gt;http://developers.arcgis.com/en/javascript/samples/fl_paging/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If one replaces the contents of function queryRecordsByPage with the following (obviously without the line numbers):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.&amp;nbsp; var query = new Query(); &amp;nbsp;&amp;nbsp;&amp;nbsp; 2.&amp;nbsp; //query.objectIds = pageInfo.objectIds.slice(begin, end); &amp;nbsp;&amp;nbsp;&amp;nbsp; 3.&amp;nbsp; query.outFields = ["*"]; &amp;nbsp;&amp;nbsp;&amp;nbsp; 4.&amp;nbsp; query.geometry = featureLayer.fullExtent; &amp;nbsp;&amp;nbsp;&amp;nbsp; 5.&amp;nbsp; //query.geometry = new esri.geometry.Extent(-1, -1, 1, 1, 4326);&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 6.&amp;nbsp; // Query for the records with the given object IDs and populate the grid &amp;nbsp;&amp;nbsp;&amp;nbsp; 7.&amp;nbsp; featureLayer.queryFeatures(query, function (featureSet) { &amp;nbsp;&amp;nbsp;&amp;nbsp; 8.&amp;nbsp;&amp;nbsp;&amp;nbsp; updateGrid(featureSet, pageNumber); &amp;nbsp;&amp;nbsp;&amp;nbsp; 9.&amp;nbsp; });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- updateGrid (line &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; gets called with the code as it is shown above. This is expected, as our query geometry has points within it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- when I comment out line 4 and uncomment line 5, updateGrid (line &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; doesn't get called at all (in this case, no points are within the custom extent).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this normal behaviour for featureLayer.queryFeatures?&amp;nbsp; I was hoping the callback would trigger, returning an empty feature set (so my code can react to the "nothing within this extent" case).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any feedback is appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jan 2014 18:43:34 GMT</pubDate>
    <dc:creator>james-rae</dc:creator>
    <dc:date>2014-01-03T18:43:34Z</dc:date>
    <item>
      <title>queryFeatures does not return if query has no results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/queryfeatures-does-not-return-if-query-has-no/m-p/546400#M50914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;featureLayer.queryFeatures appears to not execute the callback if there are no features that match the query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have modified the following sample to illustrate (JS API 3.8):&lt;/SPAN&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://developers.arcgis.com/en/javascript/samples/fl_paging/" rel="nofollow" target="_blank"&gt;http://developers.arcgis.com/en/javascript/samples/fl_paging/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If one replaces the contents of function queryRecordsByPage with the following (obviously without the line numbers):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.&amp;nbsp; var query = new Query(); &amp;nbsp;&amp;nbsp;&amp;nbsp; 2.&amp;nbsp; //query.objectIds = pageInfo.objectIds.slice(begin, end); &amp;nbsp;&amp;nbsp;&amp;nbsp; 3.&amp;nbsp; query.outFields = ["*"]; &amp;nbsp;&amp;nbsp;&amp;nbsp; 4.&amp;nbsp; query.geometry = featureLayer.fullExtent; &amp;nbsp;&amp;nbsp;&amp;nbsp; 5.&amp;nbsp; //query.geometry = new esri.geometry.Extent(-1, -1, 1, 1, 4326);&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 6.&amp;nbsp; // Query for the records with the given object IDs and populate the grid &amp;nbsp;&amp;nbsp;&amp;nbsp; 7.&amp;nbsp; featureLayer.queryFeatures(query, function (featureSet) { &amp;nbsp;&amp;nbsp;&amp;nbsp; 8.&amp;nbsp;&amp;nbsp;&amp;nbsp; updateGrid(featureSet, pageNumber); &amp;nbsp;&amp;nbsp;&amp;nbsp; 9.&amp;nbsp; });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- updateGrid (line &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; gets called with the code as it is shown above. This is expected, as our query geometry has points within it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- when I comment out line 4 and uncomment line 5, updateGrid (line &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; doesn't get called at all (in this case, no points are within the custom extent).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this normal behaviour for featureLayer.queryFeatures?&amp;nbsp; I was hoping the callback would trigger, returning an empty feature set (so my code can react to the "nothing within this extent" case).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any feedback is appreciated.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 18:43:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/queryfeatures-does-not-return-if-query-has-no/m-p/546400#M50914</guid>
      <dc:creator>james-rae</dc:creator>
      <dc:date>2014-01-03T18:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: queryFeatures does not return if query has no results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/queryfeatures-does-not-return-if-query-has-no/m-p/546401#M50915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;query.geometry = new esri.geometry.Extent(-1, -1, 1, 1, new esri.SpatialReference({wkid:4326}));&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;*edit&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;According to the documentation, the spatialReference property needs to be a spatialReference object, not a string or integer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/en/javascript/jsapi/extent.html" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/en/javascript/jsapi/extent.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jan 2014 20:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/queryfeatures-does-not-return-if-query-has-no/m-p/546401#M50915</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-01-03T20:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: queryFeatures does not return if query has no results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/queryfeatures-does-not-return-if-query-has-no/m-p/546402#M50916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Beauty.&amp;nbsp; Thank you Jon.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I love it when the fix a one-line fix due to something dumb on our end!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2014 11:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/queryfeatures-does-not-return-if-query-has-no/m-p/546402#M50916</guid>
      <dc:creator>james-rae</dc:creator>
      <dc:date>2014-01-06T11:20:16Z</dc:date>
    </item>
  </channel>
</rss>

