<?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>idea Add support for subqueries for definition queries and selections on hosted feature layers in ArcGIS Online Ideas</title>
    <link>https://community.esri.com/t5/arcgis-online-ideas/add-support-for-subqueries-for-definition-queries/idi-p/1166161</link>
    <description>&lt;P&gt;Add the ability to filter a hosted feature layer by a subquery for both definition queries and "select by attribute" workflows.&lt;/P&gt;&lt;P&gt;For me, I want to build a hosted view on top of a hosted layer.&amp;nbsp; The hosted view would limit the results to only the "most recent record" for each ID that exists in a column.&amp;nbsp; This query requires a date column and the ID column which is not unique.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;In a sql database this query would take on the following syntax:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;For the example the table we are filtering is named myTable. The column with ID's we want to group by is called myGroupID.&amp;nbsp; The column with dates to use for finding most recent record is named myDate&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select * from myTable t1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;where t1.myDate =&amp;nbsp; (SELECT max(t2.myDate) from myTable t1 where t2.myGroupID = t1.myGroupID)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT color="#000000"&gt;Other scenarios are just filtering the whole table to the one with a max value over all:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select * from myTable t1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;where t1.myDate =&amp;nbsp; (SELECT max(t2.myDate) from myTable&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;This came up a lot with Covid dashboard data.&amp;nbsp; You have a table with one row per day with various Covid numbers.&amp;nbsp; Then some places you want to filter that master dataset to data from the latest row when sorted by date.&amp;nbsp; In other places you want to use all the data to see trends.&amp;nbsp; The operations dashboard widgets provide the extra configuration steps to do this kind of sorting and filtering.&amp;nbsp; But applying the same kind of filtering to the hosted layer itself via a hosted view is missing.&amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Now, I assume that on Esri's side this would require the underlying ArcGIS Online data platform to support some kind of SQL structure.&amp;nbsp; But it wouldn't have to be RDBMS like PostGres or SQL Server.&amp;nbsp; Azure Synapse allows relatively advanced SQL queries against data lakes that include subqueries and aggregation functions.&amp;nbsp; Also, I assume that operations like this will add more load on the Esri systems since the filter needs to scan other rows and compare.&amp;nbsp; But this is handled in RDBMS with indexes.&amp;nbsp; There is already the concept in ArcGIS Online of tagging one column on a layer to be the "time aware" layer, and the trackaware GeoAnalytics tools in Pro require you to select a "Track ID" column.&amp;nbsp; If we could define these columns on the AGOL layer, they could be used to selectively build indexes on the backend to optimize these kinds of queries.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 15:22:45 GMT</pubDate>
    <dc:creator>AndrewRudin1</dc:creator>
    <dc:date>2022-04-20T15:22:45Z</dc:date>
    <item>
      <title>Add support for subqueries for definition queries and selections on hosted feature layers</title>
      <link>https://community.esri.com/t5/arcgis-online-ideas/add-support-for-subqueries-for-definition-queries/idi-p/1166161</link>
      <description>&lt;P&gt;Add the ability to filter a hosted feature layer by a subquery for both definition queries and "select by attribute" workflows.&lt;/P&gt;&lt;P&gt;For me, I want to build a hosted view on top of a hosted layer.&amp;nbsp; The hosted view would limit the results to only the "most recent record" for each ID that exists in a column.&amp;nbsp; This query requires a date column and the ID column which is not unique.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;In a sql database this query would take on the following syntax:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;For the example the table we are filtering is named myTable. The column with ID's we want to group by is called myGroupID.&amp;nbsp; The column with dates to use for finding most recent record is named myDate&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select * from myTable t1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;where t1.myDate =&amp;nbsp; (SELECT max(t2.myDate) from myTable t1 where t2.myGroupID = t1.myGroupID)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT color="#000000"&gt;Other scenarios are just filtering the whole table to the one with a max value over all:&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;select * from myTable t1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;where t1.myDate =&amp;nbsp; (SELECT max(t2.myDate) from myTable&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;This came up a lot with Covid dashboard data.&amp;nbsp; You have a table with one row per day with various Covid numbers.&amp;nbsp; Then some places you want to filter that master dataset to data from the latest row when sorted by date.&amp;nbsp; In other places you want to use all the data to see trends.&amp;nbsp; The operations dashboard widgets provide the extra configuration steps to do this kind of sorting and filtering.&amp;nbsp; But applying the same kind of filtering to the hosted layer itself via a hosted view is missing.&amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Now, I assume that on Esri's side this would require the underlying ArcGIS Online data platform to support some kind of SQL structure.&amp;nbsp; But it wouldn't have to be RDBMS like PostGres or SQL Server.&amp;nbsp; Azure Synapse allows relatively advanced SQL queries against data lakes that include subqueries and aggregation functions.&amp;nbsp; Also, I assume that operations like this will add more load on the Esri systems since the filter needs to scan other rows and compare.&amp;nbsp; But this is handled in RDBMS with indexes.&amp;nbsp; There is already the concept in ArcGIS Online of tagging one column on a layer to be the "time aware" layer, and the trackaware GeoAnalytics tools in Pro require you to select a "Track ID" column.&amp;nbsp; If we could define these columns on the AGOL layer, they could be used to selectively build indexes on the backend to optimize these kinds of queries.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 15:22:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-ideas/add-support-for-subqueries-for-definition-queries/idi-p/1166161</guid>
      <dc:creator>AndrewRudin1</dc:creator>
      <dc:date>2022-04-20T15:22:45Z</dc:date>
    </item>
  </channel>
</rss>

