<?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 arcgis 10.2 how to order query results in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665749#M62184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to order the returned results of a query task?&amp;nbsp; &lt;/P&gt;&lt;P&gt;this:&lt;/P&gt;&lt;PRE class="jive-pre"&gt;&lt;CODE&gt;query.where = "COD &amp;gt; 0"; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;works fine, but this:&lt;/P&gt;&lt;PRE class="jive-pre"&gt;&lt;CODE&gt;query.where = "COD &amp;gt; 0 order by COD"; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;throws:&lt;/P&gt;&lt;PRE class="jive-pre"&gt;&lt;CODE&gt;dojo.io.script error undefined &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please note that our server has standardized queries enabled and we cannot change that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Jun 2015 23:31:37 GMT</pubDate>
    <dc:creator>davidzornosa</dc:creator>
    <dc:date>2015-06-23T23:31:37Z</dc:date>
    <item>
      <title>arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665749#M62184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to order the returned results of a query task?&amp;nbsp; &lt;/P&gt;&lt;P&gt;this:&lt;/P&gt;&lt;PRE class="jive-pre"&gt;&lt;CODE&gt;query.where = "COD &amp;gt; 0"; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;works fine, but this:&lt;/P&gt;&lt;PRE class="jive-pre"&gt;&lt;CODE&gt;query.where = "COD &amp;gt; 0 order by COD"; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;throws:&lt;/P&gt;&lt;PRE class="jive-pre"&gt;&lt;CODE&gt;dojo.io.script error undefined &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please note that our server has standardized queries enabled and we cannot change that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 23:31:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665749#M62184</guid>
      <dc:creator>davidzornosa</dc:creator>
      <dc:date>2015-06-23T23:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665750#M62185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/103548"&gt;david zornosa&lt;/A&gt; ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you move this thread to the &lt;A href="https://community.esri.com/space/2128"&gt;ArcGIS API for JavaScript&lt;/A&gt;&amp;nbsp; place. You will get better answer in that space.&lt;/P&gt;&lt;P&gt;See: &lt;A href="https://community.esri.com/docs/DOC-2164"&gt;Moving Content&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/space/2004"&gt;GeoNet Help&lt;/A&gt; is for help on using GeoNet only.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 23:36:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665750#M62185</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-23T23:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665751#M62186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BTW: this is the page where you can consult the &lt;A href="https://community.esri.com/docs/DOC-1544"&gt;GeoNet Community Structure&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 23:39:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665751#M62186</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-23T23:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665752#M62187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; You can not just add an order by to the where. You need to use the orderByFields property of the Query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/query-amd.html#orderbyfields" title="https://developers.arcgis.com/javascript/jsapi/query-amd.html#orderbyfields"&gt;Query | API Reference | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 23:42:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665752#M62187</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-06-23T23:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665753#M62188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And now something on topic. Maybe this link will help &lt;A href="https://developers.arcgis.com/javascript/jsapi/query-amd.html#orderbyfields" title="https://developers.arcgis.com/javascript/jsapi/query-amd.html#orderbyfields"&gt;Query | API Reference | ArcGIS API for JavaScript&lt;/A&gt; . There is a orderByFields property that you could use (I think).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;edit: ...and I should have known that Robert would beat me to it..&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 23:47:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665753#M62188</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2015-06-23T23:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665754#M62189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use client side sorting for this - see this quick demo I put together: &lt;A href="http://output.jsbin.com/tazaribaje" title="http://output.jsbin.com/tazaribaje" rel="nofollow noopener noreferrer" target="_blank"&gt;QueryTask - client side sorting&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, you just use the array.sort method with an anonymous function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results.features.sort(function(a, b) {
&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; // return&amp;nbsp; a.attributes.POP2007 - b.attributes.POP2007; // ascending
&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; return&amp;nbsp; b.attributes.POP2007 - a.attributes.POP2007; // descending
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your case replace the POP2007 field name with COD to sort the features.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:08:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665754#M62189</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2021-12-12T04:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665755#M62190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like others mentioned, you could use &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;orderByFields, or client-side sorting. However, I bet it would work if you turned-off standardized queries and used a subquery for the where clause (that contained an ORDER BY). Note that I would NOT recommend doing this!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 13:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665755#M62190</guid>
      <dc:creator>ChrisSmith7</dc:creator>
      <dc:date>2015-06-24T13:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 10.2 how to order query results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665756#M62191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/103548"&gt;david zornosa&lt;/A&gt;​ Did these replies help you? If so then please make this question as Answered. And if you that that a reply was helpful then click the helpful link on that post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 20:34:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-10-2-how-to-order-query-results/m-p/665756#M62191</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-06-27T20:34:21Z</dc:date>
    </item>
  </channel>
</rss>

