<?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: Is it possible to do a feature Query from javascript client to obtain the MAX value for attribute/column in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727044#M67449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding &lt;STRONG&gt;Order By Fields: date_time desc&lt;/STRONG&gt; and retrieving the very first row will&amp;nbsp;return MAX(date_time)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jun 2017 17:47:21 GMT</pubDate>
    <dc:creator>sapnas</dc:creator>
    <dc:date>2017-06-22T17:47:21Z</dc:date>
    <item>
      <title>Is it possible to do a feature Query from javascript client to obtain the MAX value for attribute/column</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727043#M67448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm familiar with the QueryTask and Query where I can specify a WHERE clause where the layer URL is baked into the QueryTask and thus points to the table backing the layer map service. &amp;nbsp;In that case, I'm limited to specifying only the WHERE clause of a traditional SQL query.&lt;/P&gt;&lt;P&gt;In this case I want to get a maximum from a column so I would need to specify a full SQL query (or a subquery to the WHERE clause) to contain SELECT MAX("date_time"). &amp;nbsp;I see with ArcMap, there is a full SQL API to query but nothing equivalent for a javascript client using the SDK (3.2)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to specify something like myQuery.where = "EXISTS (SELECT MAX(date_time))" , then execute the query within the QueryTask pointing to the layer Url ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is not possible, is there any other way to do this, perhaps using statistics?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 16:54:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727043#M67448</guid>
      <dc:creator>DannyVenier</dc:creator>
      <dc:date>2017-06-22T16:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do a feature Query from javascript client to obtain the MAX value for attribute/column</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727044#M67449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Adding &lt;STRONG&gt;Order By Fields: date_time desc&lt;/STRONG&gt; and retrieving the very first row will&amp;nbsp;return MAX(date_time)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 17:47:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727044#M67449</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2017-06-22T17:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do a feature Query from javascript client to obtain the MAX value for attribute/column</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727045#M67450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestion. &amp;nbsp;Is it possible to add the Order By clause to a WHERE clause? &amp;nbsp;The issue is that there is perhaps 1 million records for which I need the maximum (most recent) time. &amp;nbsp;But I don't want to retrieve a million records because of the time/resources needed. &amp;nbsp;So I was hoping to have the processing done on the server side and just return the scalar result. &amp;nbsp;What you're suggesting would require a WHERE clause that generates a sorted (temporary) result on the server from which&amp;nbsp;another query could grab the first row. &amp;nbsp;The real issue seems to be that the client has no means to form and execute a proper SQL query. &amp;nbsp;We are limited to a WHERE clause which is then (probably) massaged by the SDK into a full SQL query by adding the outfields part and the FROM table part. &amp;nbsp;I'm thinking perhaps the statistics APIs might allow for a scalar function against the DB/table but have not experimented with those APIs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:18:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727045#M67450</guid>
      <dc:creator>DannyVenier</dc:creator>
      <dc:date>2017-06-22T18:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do a feature Query from javascript client to obtain the MAX value for attribute/column</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727046#M67451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; "statisticType": "max",&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; "onStatisticField": "date_time", &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; "outStatisticFieldName": "date_time"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; }]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass this definition to outstatistics. Here is the linke if you additional information&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://resources.arcgis.com/en/help/rest/apiref/fsquery.html" title="http://resources.arcgis.com/en/help/rest/apiref/fsquery.html"&gt;Query - Feature Service (Operation)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:30:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727046#M67451</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2017-06-22T18:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do a feature Query from javascript client to obtain the MAX value for attribute/column</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727047#M67452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Normally when I have a very complex query I would either end up creating a spatial view and publishing that as a map service Or use my custom server side code and build queries dynamically.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 18:49:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727047#M67452</guid>
      <dc:creator>sapnas</dc:creator>
      <dc:date>2017-06-22T18:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to do a feature Query from javascript client to obtain the MAX value for attribute/column</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727048#M67453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Much thanks Sapna, that did the trick. &amp;nbsp;I have one other issue in that some columns were published with dots in the name (like DB.DATE_TIME) and the dot notation seems to be unwelcome, but when I try your stats query on a column without the dot character it works great. &amp;nbsp;Will probably need to get the data published in a friendlier form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again for taking the time to help.&lt;/P&gt;&lt;P&gt;--Danny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2017 19:17:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-do-a-feature-query-from/m-p/727048#M67453</guid>
      <dc:creator>DannyVenier</dc:creator>
      <dc:date>2017-06-22T19:17:04Z</dc:date>
    </item>
  </channel>
</rss>

