<?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 Arcade GroupBy() examples in the docs: Show what the resulting SQL looks like in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/arcade-groupby-examples-in-the-docs-show-what-the/idi-p/1155122</link>
    <description>&lt;P&gt;&lt;BR /&gt;The Arcade docs have examples for the &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#groupby" target="_self"&gt;GroupBy()&lt;/A&gt; function:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Returns the count and the average height of each tree type&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; treeStats = &lt;SPAN class=""&gt;GroupBy&lt;/SPAN&gt;(&lt;SPAN class=""&gt;$layer&lt;/SPAN&gt;,
  [  &lt;SPAN class=""&gt;// fields/expressions to group statistics by&lt;/SPAN&gt;
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Type'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'TreeType'&lt;/SPAN&gt;},
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Status'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'TreeStatus'&lt;/SPAN&gt;}
  ], 
  [  &lt;SPAN class=""&gt;// statistics to return for each unique category&lt;/SPAN&gt;
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Total'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'1'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;statistic&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'COUNT'&lt;/SPAN&gt; }, 
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'AvgHeight'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Height'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;statistic&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'AVG'&lt;/SPAN&gt; }, 
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'MaxPercentCoverage'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'CoverageRatio * 100'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;statistic&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'MAX'&lt;/SPAN&gt; }
  ]
);
&lt;SPAN class=""&gt;// treeStats contains features with columns Type, Status, Total, AvgHeight, MaxPercentCoverage&lt;/SPAN&gt;
&lt;SPAN class=""&gt;// Each unique tree type (combination of type and status) will have a count, average height, and maximum value of percent coverage&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;That GroupBy() stuff can get messy in a hurry. It would help if we could see what the SQL would look like, right in the docs.&lt;BR /&gt;(possibly as a comment in the Arcade code example)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Mar 2022 03:31:02 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2022-03-18T03:31:02Z</dc:date>
    <item>
      <title>Arcade GroupBy() examples in the docs: Show what the resulting SQL looks like</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcade-groupby-examples-in-the-docs-show-what-the/idi-p/1155122</link>
      <description>&lt;P&gt;&lt;BR /&gt;The Arcade docs have examples for the &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#groupby" target="_self"&gt;GroupBy()&lt;/A&gt; function:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Returns the count and the average height of each tree type&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt; treeStats = &lt;SPAN class=""&gt;GroupBy&lt;/SPAN&gt;(&lt;SPAN class=""&gt;$layer&lt;/SPAN&gt;,
  [  &lt;SPAN class=""&gt;// fields/expressions to group statistics by&lt;/SPAN&gt;
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Type'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'TreeType'&lt;/SPAN&gt;},
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Status'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'TreeStatus'&lt;/SPAN&gt;}
  ], 
  [  &lt;SPAN class=""&gt;// statistics to return for each unique category&lt;/SPAN&gt;
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Total'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'1'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;statistic&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'COUNT'&lt;/SPAN&gt; }, 
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'AvgHeight'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'Height'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;statistic&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'AVG'&lt;/SPAN&gt; }, 
    { &lt;SPAN class=""&gt;name&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'MaxPercentCoverage'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;expression&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'CoverageRatio * 100'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;statistic&lt;/SPAN&gt;: &lt;SPAN class=""&gt;'MAX'&lt;/SPAN&gt; }
  ]
);
&lt;SPAN class=""&gt;// treeStats contains features with columns Type, Status, Total, AvgHeight, MaxPercentCoverage&lt;/SPAN&gt;
&lt;SPAN class=""&gt;// Each unique tree type (combination of type and status) will have a count, average height, and maximum value of percent coverage&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;That GroupBy() stuff can get messy in a hurry. It would help if we could see what the SQL would look like, right in the docs.&lt;BR /&gt;(possibly as a comment in the Arcade code example)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 03:31:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcade-groupby-examples-in-the-docs-show-what-the/idi-p/1155122</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-03-18T03:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade GroupBy() examples in the docs: Show what the resulting SQL looks like</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcade-groupby-examples-in-the-docs-show-what-the/idc-p/1401911#M29130</link>
      <description>&lt;P&gt;As a workaround, I suppose we could implement the sample code and then look at the Logs tab in the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/get-started/arcgis-diagnostic-monitor.htm" target="_self"&gt;Diagnostic Monitor in ArcGIS Pro&lt;/A&gt; (in the Help tab in the ribbon). One of the End Cursor log entries might show the SQL query that’s sent to the database. Untested.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2024 13:06:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcade-groupby-examples-in-the-docs-show-what-the/idc-p/1401911#M29130</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-03-28T13:06:28Z</dc:date>
    </item>
  </channel>
</rss>

