<?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 Query results into ADG and sorting in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/query-results-into-adg-and-sorting/m-p/647385#M14379</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;So am loading a bunch of points into an ADG and point on the map too. There are these little functions that do a relationship query based on a landmark type. All was working great, the issue was sorting the results alphabetically in the ADG. When you click on the top column of the ADG, it sorted them, but when you select an item from the ADG, the map would zoom to an incorrect point, far away from the intended location. This didn't happen if you didn't sort the results. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added code to sort the results programatically with the same issue. The map zooms to the wrong point. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function doQueryLandmarkAppliances(event:Event) : void{ landmarkTypeQueryTask = null;


&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask = new QueryTask;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var landmarksRelationshipQuery:RelationshipQuery = new RelationshipQuery();&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; landmarksRelationshipQuery.objectIds = [120]; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.relationshipId = 3; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.outFields = ["*"]; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.returnGeometry = true; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.outSpatialReference = myMap.spatialReference;
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask.method = URLRequestMethod.POST;
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask.url = "http://arcgis4.roktech.net/arcgis/rest/services/DigitalEgypt/EGIPA_NewCairo/MapServer/25";
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask.executeRelationshipQuery(landmarksRelationshipQuery, new AsyncResponder(onLandmarksAppliancesResult, onRelationshiptQueryFault, null));
}

private function onLandmarksAppliancesResult( result:Object, token:Object = null ) : void
{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkResultsCount = result[120].features.length;
&amp;nbsp;&amp;nbsp;&amp;nbsp; launchLandmarksADG(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksADGVar.landmarksADG.dataProvider =&amp;nbsp; sortAttributes(result[120].attributes);
&amp;nbsp;&amp;nbsp;&amp;nbsp; for each (myLandmarksGraphic in result[120].features)
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectedLandmarkObjectID = myLandmarksGraphic.attributes.OBJECTID;&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; myLandmarksGraphic.symbol = appliancesMMarker;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksGraphicsLayer.add(myLandmarksGraphic);&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; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}

private function sortAttributes(attrs:Array):Array
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return attrs.sortOn("LandmarkEName");
}

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Feb 2014 11:23:42 GMT</pubDate>
    <dc:creator>raffia</dc:creator>
    <dc:date>2014-02-13T11:23:42Z</dc:date>
    <item>
      <title>Query results into ADG and sorting</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/query-results-into-adg-and-sorting/m-p/647385#M14379</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;So am loading a bunch of points into an ADG and point on the map too. There are these little functions that do a relationship query based on a landmark type. All was working great, the issue was sorting the results alphabetically in the ADG. When you click on the top column of the ADG, it sorted them, but when you select an item from the ADG, the map would zoom to an incorrect point, far away from the intended location. This didn't happen if you didn't sort the results. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added code to sort the results programatically with the same issue. The map zooms to the wrong point. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function doQueryLandmarkAppliances(event:Event) : void{ landmarkTypeQueryTask = null;


&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask = new QueryTask;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var landmarksRelationshipQuery:RelationshipQuery = new RelationshipQuery();&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; landmarksRelationshipQuery.objectIds = [120]; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.relationshipId = 3; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.outFields = ["*"]; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.returnGeometry = true; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksRelationshipQuery.outSpatialReference = myMap.spatialReference;
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask.method = URLRequestMethod.POST;
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask.url = "http://arcgis4.roktech.net/arcgis/rest/services/DigitalEgypt/EGIPA_NewCairo/MapServer/25";
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkTypeQueryTask.executeRelationshipQuery(landmarksRelationshipQuery, new AsyncResponder(onLandmarksAppliancesResult, onRelationshiptQueryFault, null));
}

private function onLandmarksAppliancesResult( result:Object, token:Object = null ) : void
{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarkResultsCount = result[120].features.length;
&amp;nbsp;&amp;nbsp;&amp;nbsp; launchLandmarksADG(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksADGVar.landmarksADG.dataProvider =&amp;nbsp; sortAttributes(result[120].attributes);
&amp;nbsp;&amp;nbsp;&amp;nbsp; for each (myLandmarksGraphic in result[120].features)
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectedLandmarkObjectID = myLandmarksGraphic.attributes.OBJECTID;&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; myLandmarksGraphic.symbol = appliancesMMarker;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; landmarksGraphicsLayer.add(myLandmarksGraphic);&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; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; 
}

private function sortAttributes(attrs:Array):Array
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return attrs.sortOn("LandmarkEName");
}

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Feb 2014 11:23:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/query-results-into-adg-and-sorting/m-p/647385#M14379</guid>
      <dc:creator>raffia</dc:creator>
      <dc:date>2014-02-13T11:23:42Z</dc:date>
    </item>
  </channel>
</rss>

