<?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 Why is my QueryTask not reflecting recent feature changes? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-querytask-not-reflecting-recent-feature/m-p/16970#M1540</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using ArcGIS for JavaScript v.3.27 with a REST server running v.10.31.&amp;nbsp; I typically develop on Firefox 66 but I test on other browsers.&amp;nbsp; The behavior I describe here has been verified in Firefox and Chrome.&lt;/P&gt;&lt;P&gt;I am using a map to load various layers, some of which are editable Feature Layers.&amp;nbsp; The general idea is that my users will have access to a tool in the Template Picker if an editable layer has no features and the appropriate tool leaves the Template Picker if a feature is added for that layer.&amp;nbsp; I am able to populate my Template Picker on load as expected based on which layers are loaded and if they already have more than zero features.&amp;nbsp; The general algorithm is to allow my user to place a feature and then on draw-end, update my database and remove the corresponding tool from the Template Picker (or conversely, allow my user to delete a feature, which would update the database with the removal and then add that tool back to the Template Picker).&lt;/P&gt;&lt;P&gt;Best practices teach me that the best method in this case is to use the database as a source of truth for all operations.&amp;nbsp; My plan then would be:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;user draws feature&lt;/LI&gt;&lt;LI&gt;save changes to database&lt;/LI&gt;&lt;LI&gt;solicit database to verify changes are in place&lt;/LI&gt;&lt;LI&gt;update Template Picker accordingly&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;NBD, right?&amp;nbsp; Except the QueryTask isn't reflecting the changes to the database.&amp;nbsp; In troubleshooting this, I have placed a loop in the code to just eat up 30 seconds of time so I can go into my database access client and verify that the data has been removed from the database. Yet the Query comes back indicating the data still exists.&amp;nbsp; It is not until I refresh the page that the change in the database is reflected by the Feature Layer in the browser.&lt;/P&gt;&lt;P&gt;(The loop I created has since been removed.&amp;nbsp; It was for troubleshooting purposes only.&amp;nbsp; Please do not get hung up on that part.&amp;nbsp; That was a troubleshooting measure, not part of the code I am currently running.)&lt;/P&gt;&lt;P&gt;What could be causing this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Apr 2019 16:58:52 GMT</pubDate>
    <dc:creator>JasonStarks</dc:creator>
    <dc:date>2019-04-11T16:58:52Z</dc:date>
    <item>
      <title>Why is my QueryTask not reflecting recent feature changes?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-querytask-not-reflecting-recent-feature/m-p/16970#M1540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using ArcGIS for JavaScript v.3.27 with a REST server running v.10.31.&amp;nbsp; I typically develop on Firefox 66 but I test on other browsers.&amp;nbsp; The behavior I describe here has been verified in Firefox and Chrome.&lt;/P&gt;&lt;P&gt;I am using a map to load various layers, some of which are editable Feature Layers.&amp;nbsp; The general idea is that my users will have access to a tool in the Template Picker if an editable layer has no features and the appropriate tool leaves the Template Picker if a feature is added for that layer.&amp;nbsp; I am able to populate my Template Picker on load as expected based on which layers are loaded and if they already have more than zero features.&amp;nbsp; The general algorithm is to allow my user to place a feature and then on draw-end, update my database and remove the corresponding tool from the Template Picker (or conversely, allow my user to delete a feature, which would update the database with the removal and then add that tool back to the Template Picker).&lt;/P&gt;&lt;P&gt;Best practices teach me that the best method in this case is to use the database as a source of truth for all operations.&amp;nbsp; My plan then would be:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;user draws feature&lt;/LI&gt;&lt;LI&gt;save changes to database&lt;/LI&gt;&lt;LI&gt;solicit database to verify changes are in place&lt;/LI&gt;&lt;LI&gt;update Template Picker accordingly&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;NBD, right?&amp;nbsp; Except the QueryTask isn't reflecting the changes to the database.&amp;nbsp; In troubleshooting this, I have placed a loop in the code to just eat up 30 seconds of time so I can go into my database access client and verify that the data has been removed from the database. Yet the Query comes back indicating the data still exists.&amp;nbsp; It is not until I refresh the page that the change in the database is reflected by the Feature Layer in the browser.&lt;/P&gt;&lt;P&gt;(The loop I created has since been removed.&amp;nbsp; It was for troubleshooting purposes only.&amp;nbsp; Please do not get hung up on that part.&amp;nbsp; That was a troubleshooting measure, not part of the code I am currently running.)&lt;/P&gt;&lt;P&gt;What could be causing this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Apr 2019 16:58:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-my-querytask-not-reflecting-recent-feature/m-p/16970#M1540</guid>
      <dc:creator>JasonStarks</dc:creator>
      <dc:date>2019-04-11T16:58:52Z</dc:date>
    </item>
  </channel>
</rss>

