<?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 does not always return all the features it should in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/querytask-does-not-always-return-all-the-features/m-p/271038#M6342</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm answering my own question, but I wanted to post what I hope is the final resolution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure why I had an extent set on the query.&amp;nbsp; Somewhere along the line I thought I needed it.&amp;nbsp; I guess for the end users with their different screen sizes and resolutions the extent I'd defined at the start didn't work for them.&amp;nbsp; The map drew OK, but the query was cutting off the counties along the borders.&amp;nbsp; Once I removed &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;coQuery.geometry = mainMap.extent;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; all was well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Apr 2012 20:10:20 GMT</pubDate>
    <dc:creator>TracySchloss</dc:creator>
    <dc:date>2012-04-03T20:10:20Z</dc:date>
    <item>
      <title>querytask does not always return all the features it should</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/querytask-does-not-always-return-all-the-features/m-p/271037#M6341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a an application that will let the user make a few selections for a menu and based on their choices runs a querytask generates a cholorpleth map.&amp;nbsp; Because it's dynamic, the querytask and query are both created dynamically within actionscript.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This function handles the users selection:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;protected function btn_loadMap_clickHandler(event:MouseEvent):void { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (categoryList.selectedIndex &amp;gt; -1 ) {&amp;nbsp; //must have selected something from the dropdownlist &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; category = categoryList.selectedItem.data; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( mapList.selectedIndex &amp;gt; -1) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapChoice = mapList.selectedItem.data; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!category || !mapChoice) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show("Please select both a chemical use and map type.", "Need Selections to Generate Map"); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yearValue = radio_yearButtons.selectedValue;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (categoryList.selectedIndex &amp;gt; -1 &amp;amp;&amp;amp; mapList.selectedIndex &amp;gt; -1) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; classBreakField = category + "_" + yearValue + "_" + mapChoice; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapTitle.text = yearValue + " - " + categoryArrayObj[category] + ", " + mapTopicArrayObj[mapChoice]; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lblLegend.text = mapTopicArrayObj[mapChoice] + " - " + yearValue;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; qryTask_selectedField(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once the selection has been made, the function qryTask_selectedField is called and it creates and executes the query and querytask.&amp;nbsp; This is county based data and all counties should be returned from the query.&amp;nbsp; All fields have some data value in &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;private function qryTask_selectedField ():void&amp;nbsp; {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; trace ("in qrytask_selectedField function"); &amp;nbsp;&amp;nbsp;&amp;nbsp; graphicsLayer.clear(); &amp;nbsp;&amp;nbsp;&amp;nbsp; mainMap.infoWindow.hide(); &amp;nbsp;&amp;nbsp;&amp;nbsp; var coQryTask:QueryTask = new QueryTask ();&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; coQryTask.showBusyCursor = true; &amp;nbsp;&amp;nbsp;&amp;nbsp; coQuery.geometry = mainMap.extent; &amp;nbsp;&amp;nbsp;&amp;nbsp; coQryTask.useAMF=false; &amp;nbsp;&amp;nbsp;&amp;nbsp; coQryTask.url = "http://" + localpathName + "/arcgis/rest/services/EPHT_AgChemical_county/MapServer/0" &amp;nbsp;&amp;nbsp;&amp;nbsp; coQryTask.addEventListener(QueryEvent.EXECUTE_COMPLETE, coResult); &amp;nbsp;&amp;nbsp;&amp;nbsp; coQryTask.addEventListener(FaultEvent.FAULT, onFault); &amp;nbsp;&amp;nbsp;&amp;nbsp; coQryTask.execute(coQuery); &amp;nbsp;&amp;nbsp;&amp;nbsp; //coQryTask.execute(coQuery, new AsyncResponder( coResult, onFault ));&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can see I started out with an asyncResponder, which I've always used for my querytasks.&amp;nbsp; It worked just great for me every time.&amp;nbsp; The problem is that my test users have not always seeing all the counties shaded in.&amp;nbsp;&amp;nbsp;&amp;nbsp; I changed it around to have listeners on the QueryEvent for EXECUTE_COMPLETE and for the fault.&amp;nbsp; Maybe I'm not correct yet in my syntax.&amp;nbsp; It still works for me and it still doesn't work for my users! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to see if the number of features was being returns correctly and not just some random color problem from my dynamic class renderer. I put a small label at the bottom of my map.&amp;nbsp; It is set as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;s:Label id="lbl_featureCount" text="Number of features from query:" fontStyle="italic" /&amp;gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I populate this with the number of features in the featureset.&amp;nbsp; The query should always return 115 features (the number of counties in Missouri).&amp;nbsp; Users have randomly been getting 105, 107, 111 and sometimes all 115.&amp;nbsp; I feel like the query task isn't fully complete before it sets the graphicLayer.graphicProvider, but it's just so random!&amp;nbsp; I thought the queryEvent executecomplete event would take care of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will add that these users are actually on the same campus as our AGS server and I'm in another part of town!&amp;nbsp; The coResult function is quite complex.&amp;nbsp; If anyone thinks seeing it will help, I can post as an attachment in a reply.&amp;nbsp; I doubt it will fit in this dialog box!&amp;nbsp; As you can see with my AMF=false, my AGS server is still at version 9.3.&amp;nbsp; Maybe some day we'll be ready to upgrade!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 18:55:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/querytask-does-not-always-return-all-the-features/m-p/271037#M6341</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2012-04-03T18:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: querytask does not always return all the features it should</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/querytask-does-not-always-return-all-the-features/m-p/271038#M6342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm answering my own question, but I wanted to post what I hope is the final resolution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not sure why I had an extent set on the query.&amp;nbsp; Somewhere along the line I thought I needed it.&amp;nbsp; I guess for the end users with their different screen sizes and resolutions the extent I'd defined at the start didn't work for them.&amp;nbsp; The map drew OK, but the query was cutting off the counties along the borders.&amp;nbsp; Once I removed &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;coQuery.geometry = mainMap.extent;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; all was well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 20:10:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/querytask-does-not-always-return-all-the-features/m-p/271038#M6342</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2012-04-03T20:10:20Z</dc:date>
    </item>
  </channel>
</rss>

