<?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: QueryTask results not loading after refresh in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-results-not-loading-after-refresh/m-p/361249#M33431</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jenn,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Changing very little beside the map service and where clause and a little styling. Your code works for me every time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE HTML&amp;gt;&amp;nbsp; 
&amp;lt;html&amp;gt;&amp;nbsp; 
&amp;lt;head&amp;gt;&amp;nbsp; 
 &amp;lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" &amp;gt;&amp;nbsp; 
 &amp;lt;title&amp;gt;CRM Project Creator&amp;lt;/title&amp;gt;&amp;nbsp; 
 &amp;lt;!--&amp;lt;link rel="stylesheet" type="text/css" href="style.css"&amp;gt;--&amp;gt;&amp;nbsp;&amp;nbsp; 
&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.9/js/esri/css/esri.css" rel="nofollow noopener noreferrer" target="_blank"&gt;http://js.arcgis.com/3.9/js/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt; &lt;/SPAN&gt;
&lt;SPAN&gt; &amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.9/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://js.arcgis.com/3.9/&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;
&amp;nbsp; &amp;lt;style&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/style&amp;gt;
&amp;lt;script&amp;gt;&amp;nbsp; 
 var map;&amp;nbsp; 
 var symbol;&amp;nbsp; 
 require([&amp;nbsp; 
&amp;nbsp; "esri/map",&amp;nbsp; 
&amp;nbsp; "esri/layers/ArcGISDynamicMapServiceLayer",&amp;nbsp; 
&amp;nbsp; "esri/tasks/query", "esri/tasks/QueryTask",&amp;nbsp; 
&amp;nbsp; "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color",&amp;nbsp; 
&amp;nbsp; "dojo/domReady!"&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; ], function (&amp;nbsp; 
&amp;nbsp; Map, ArcGISDynamicMapServiceLayer,&amp;nbsp; 
&amp;nbsp; Query, QueryTask, SimpleFillSymbol, SimpleLineSymbol,&amp;nbsp; 
&amp;nbsp; Color) {&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; map = new Map("map", {&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; basemap: "streets",&amp;nbsp; 
&amp;nbsp;&amp;nbsp; center: [-122.86, 49.1],&amp;nbsp; 
&amp;nbsp;&amp;nbsp; zoom: 10&amp;nbsp; 
&amp;nbsp; });&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; // query code&amp;nbsp; 
&amp;nbsp; var query = new Query();&amp;nbsp; 
&lt;SPAN&gt;&amp;nbsp; var queryTask = new QueryTask("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/2" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/2&lt;/A&gt;&lt;SPAN&gt;");&amp;nbsp; &lt;/SPAN&gt;
&amp;nbsp; query.where = "ZONING_TYPE LIKE 'COMMERCIAL%'";&amp;nbsp; 
&amp;nbsp; query.returnGeometry = true;&amp;nbsp; 
&amp;nbsp; query.outFields = ["*"];&amp;nbsp; 
&amp;nbsp; //query.outSpatialReference = new esri.SpatialReference({wkid : 4326});&amp;nbsp; 
&amp;nbsp; queryTask.execute(query, showResults);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; symbol = new SimpleFillSymbol();&amp;nbsp; 
&amp;nbsp; symbol.setStyle(SimpleFillSymbol.STYLE_SOLID);&amp;nbsp; 
&amp;nbsp; symbol.setColor(new Color([255,0,255,1]));&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; function showResults(results) {&amp;nbsp; 
&amp;nbsp;&amp;nbsp; map.graphics.clear();&amp;nbsp; 
&amp;nbsp;&amp;nbsp; var resultFeatures = results.features;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; for (i=0, il=resultFeatures.length; i&amp;lt;il; i++) {&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = resultFeatures&lt;I&gt;;&amp;nbsp; &lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setSymbol(symbol);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(graphic);&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }&amp;nbsp; 
&amp;nbsp;&amp;nbsp; // set the extents of the query results&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; var extent = esri.graphicsExtent(results.features);&amp;nbsp; 
&amp;nbsp;&amp;nbsp; map.setExtent(extent.expand(1.5),true);&amp;nbsp;&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp; }&amp;nbsp; 
 });&amp;nbsp; 
&amp;lt;/script&amp;gt;
&amp;nbsp; 
&amp;lt;/head&amp;gt;
&amp;nbsp; 
&amp;lt;body&amp;gt;
&amp;nbsp; 
 &amp;lt;div id="map"&amp;gt;&amp;lt;/div&amp;gt;
&amp;nbsp; 
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:51:21 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2021-12-11T16:51:21Z</dc:date>
    <item>
      <title>QueryTask results not loading after refresh</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-results-not-loading-after-refresh/m-p/361248#M33430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a QueryTask script and it only works the first time in a given browser or computer (it worked once in Firefox, Chrome and IE on work computer, and once in Firefox on my home computer). Now, whenever I refresh or access the page again the results don't show. I don't have this problem if I return the results as text; I can refresh as many times as I want and it works fine. Yep, I've restarted and cleared caches! It's my first time trying to build a web map with querying functionality so I might be missing something really obvious... Please let me know if I need to explain something better, too! Thanks a bunch!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
 &amp;lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" &amp;gt;
 &amp;lt;title&amp;gt;CRM Project Creator&amp;lt;/title&amp;gt;
 &amp;lt;!--&amp;lt;link rel="stylesheet" type="text/css" href="style.css"&amp;gt;--&amp;gt; 
 &amp;lt;link rel="stylesheet" href="&lt;A href="http://js.arcgis.com/3.9/js/esri/css/esri.css" rel="nofollow noopener noreferrer" target="_blank"&gt;http://js.arcgis.com/3.9/js/esri/css/esri.css&lt;/A&gt;"&amp;gt; 
 &amp;lt;script src="&lt;A href="http://js.arcgis.com/3.9/&amp;quot;&amp;gt;&amp;lt;/script" rel="nofollow noopener noreferrer" target="_blank"&gt;http://js.arcgis.com/3.9/"&amp;gt;&amp;lt;/script&lt;/A&gt;&amp;gt;

&amp;lt;script&amp;gt;
 var map;
 var symbol;
 require([
&amp;nbsp; "esri/map",
&amp;nbsp; "esri/layers/ArcGISDynamicMapServiceLayer",
&amp;nbsp; "esri/tasks/query", "esri/tasks/QueryTask",
&amp;nbsp; "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color",
&amp;nbsp; "dojo/domReady!"

&amp;nbsp;&amp;nbsp; ], function (
&amp;nbsp; Map, ArcGISDynamicMapServiceLayer,
&amp;nbsp; Query, QueryTask, SimpleFillSymbol, SimpleLineSymbol,
&amp;nbsp; Color) {

&amp;nbsp; map = new Map("map", { 
&amp;nbsp;&amp;nbsp; basemap: "streets",
&amp;nbsp;&amp;nbsp; center: [-122.86, 49.1],
&amp;nbsp;&amp;nbsp; zoom: 10
&amp;nbsp; });

&amp;nbsp; // query code
&amp;nbsp; var query = new Query();
&amp;nbsp; var queryTask = new QueryTask("&lt;A _jive_internal="true" href="https://community.esri.com/[redacted]/MapServer/50" target="_blank"&gt;http://[redacted]/MapServer/50&lt;/A&gt;");
&amp;nbsp; query.where = "Project_Number LIKE '%00%'";
&amp;nbsp; query.returnGeometry = true;
&amp;nbsp; query.outFields = ["*"];
&amp;nbsp; //query.outSpatialReference = new esri.SpatialReference({wkid : 4326});
&amp;nbsp; queryTask.execute(query, showResults);

&amp;nbsp; symbol = new SimpleFillSymbol();
&amp;nbsp; symbol.setStyle(SimpleFillSymbol.STYLE_SOLID);
&amp;nbsp; symbol.setColor(new Color([255,0,255,1]));

&amp;nbsp; function showResults(results) {
&amp;nbsp;&amp;nbsp; map.graphics.clear();
&amp;nbsp;&amp;nbsp; var resultFeatures = results.features;
&amp;nbsp;&amp;nbsp; for (i=0, il=resultFeatures.length; i&amp;lt;il; i++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = resultFeatures&lt;I&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setSymbol(symbol);
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(graphic);
&amp;nbsp;&amp;nbsp; }&lt;/I&gt;
&amp;nbsp;&amp;nbsp; // set the extents of the query results 
&amp;nbsp;&amp;nbsp; var extent = esri.graphicsExtent(results.features);
&amp;nbsp;&amp;nbsp; map.setExtent(extent.expand(1.5),true); 

&amp;nbsp; }
 });
&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;

 &amp;lt;div id="map" style="width:1280px;height:860px"&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:51:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-results-not-loading-after-refresh/m-p/361248#M33430</guid>
      <dc:creator>JennB</dc:creator>
      <dc:date>2021-12-11T16:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask results not loading after refresh</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-results-not-loading-after-refresh/m-p/361249#M33431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jenn,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Changing very little beside the map service and where clause and a little styling. Your code works for me every time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE HTML&amp;gt;&amp;nbsp; 
&amp;lt;html&amp;gt;&amp;nbsp; 
&amp;lt;head&amp;gt;&amp;nbsp; 
 &amp;lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" &amp;gt;&amp;nbsp; 
 &amp;lt;title&amp;gt;CRM Project Creator&amp;lt;/title&amp;gt;&amp;nbsp; 
 &amp;lt;!--&amp;lt;link rel="stylesheet" type="text/css" href="style.css"&amp;gt;--&amp;gt;&amp;nbsp;&amp;nbsp; 
&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.9/js/esri/css/esri.css" rel="nofollow noopener noreferrer" target="_blank"&gt;http://js.arcgis.com/3.9/js/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt; &lt;/SPAN&gt;
&lt;SPAN&gt; &amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://js.arcgis.com/3.9/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://js.arcgis.com/3.9/&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;
&amp;nbsp; &amp;lt;style&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/style&amp;gt;
&amp;lt;script&amp;gt;&amp;nbsp; 
 var map;&amp;nbsp; 
 var symbol;&amp;nbsp; 
 require([&amp;nbsp; 
&amp;nbsp; "esri/map",&amp;nbsp; 
&amp;nbsp; "esri/layers/ArcGISDynamicMapServiceLayer",&amp;nbsp; 
&amp;nbsp; "esri/tasks/query", "esri/tasks/QueryTask",&amp;nbsp; 
&amp;nbsp; "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleLineSymbol", "esri/Color",&amp;nbsp; 
&amp;nbsp; "dojo/domReady!"&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; ], function (&amp;nbsp; 
&amp;nbsp; Map, ArcGISDynamicMapServiceLayer,&amp;nbsp; 
&amp;nbsp; Query, QueryTask, SimpleFillSymbol, SimpleLineSymbol,&amp;nbsp; 
&amp;nbsp; Color) {&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; map = new Map("map", {&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; basemap: "streets",&amp;nbsp; 
&amp;nbsp;&amp;nbsp; center: [-122.86, 49.1],&amp;nbsp; 
&amp;nbsp;&amp;nbsp; zoom: 10&amp;nbsp; 
&amp;nbsp; });&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; // query code&amp;nbsp; 
&amp;nbsp; var query = new Query();&amp;nbsp; 
&lt;SPAN&gt;&amp;nbsp; var queryTask = new QueryTask("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/2" rel="nofollow noopener noreferrer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/2&lt;/A&gt;&lt;SPAN&gt;");&amp;nbsp; &lt;/SPAN&gt;
&amp;nbsp; query.where = "ZONING_TYPE LIKE 'COMMERCIAL%'";&amp;nbsp; 
&amp;nbsp; query.returnGeometry = true;&amp;nbsp; 
&amp;nbsp; query.outFields = ["*"];&amp;nbsp; 
&amp;nbsp; //query.outSpatialReference = new esri.SpatialReference({wkid : 4326});&amp;nbsp; 
&amp;nbsp; queryTask.execute(query, showResults);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; symbol = new SimpleFillSymbol();&amp;nbsp; 
&amp;nbsp; symbol.setStyle(SimpleFillSymbol.STYLE_SOLID);&amp;nbsp; 
&amp;nbsp; symbol.setColor(new Color([255,0,255,1]));&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; function showResults(results) {&amp;nbsp; 
&amp;nbsp;&amp;nbsp; map.graphics.clear();&amp;nbsp; 
&amp;nbsp;&amp;nbsp; var resultFeatures = results.features;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; for (i=0, il=resultFeatures.length; i&amp;lt;il; i++) {&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = resultFeatures&lt;I&gt;;&amp;nbsp; &lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setSymbol(symbol);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(graphic);&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }&amp;nbsp; 
&amp;nbsp;&amp;nbsp; // set the extents of the query results&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; var extent = esri.graphicsExtent(results.features);&amp;nbsp; 
&amp;nbsp;&amp;nbsp; map.setExtent(extent.expand(1.5),true);&amp;nbsp;&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp; }&amp;nbsp; 
 });&amp;nbsp; 
&amp;lt;/script&amp;gt;
&amp;nbsp; 
&amp;lt;/head&amp;gt;
&amp;nbsp; 
&amp;lt;body&amp;gt;
&amp;nbsp; 
 &amp;lt;div id="map"&amp;gt;&amp;lt;/div&amp;gt;
&amp;nbsp; 
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:51:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-results-not-loading-after-refresh/m-p/361249#M33431</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T16:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask results not loading after refresh</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-results-not-loading-after-refresh/m-p/361250#M33432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all, thank you so much for taking time to do this! Your help is definitely appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, this is very curious. I was able to refresh as many times as I wanted in whichever browsers I so desired and you're right - the code works. I think the next step is to start looking at server logs as this says to me it's not a coding issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, for anyone else reading this, if you have any knowledge to impart I'd be very grateful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again, Robert. Have a great day!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 22:04:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-results-not-loading-after-refresh/m-p/361250#M33432</guid>
      <dc:creator>JennB</dc:creator>
      <dc:date>2014-11-25T22:04:12Z</dc:date>
    </item>
  </channel>
</rss>

