The Arcade docs have examples for the GroupBy() function:
Returns the count and the average height of each tree type
var treeStats = GroupBy($layer, [ // fields/expressions to group statistics by { name: 'Type', expression: 'TreeType'}, { name: 'Status', expression: 'TreeStatus'} ], [ // statistics to return for each unique category { name: 'Total', expression: '1', statistic: 'COUNT' }, { name: 'AvgHeight', expression: 'Height', statistic: 'AVG' }, { name: 'MaxPercentCoverage', expression: 'CoverageRatio * 100', statistic: 'MAX' } ] ); // treeStats contains features with columns Type, Status, Total, AvgHeight, MaxPercentCoverage // Each unique tree type (combination of type and status) will have a count, average height, and maximum value of percent coverage
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.
(possibly as a comment in the Arcade code example)
As a workaround, I suppose we could implement the sample code and then look at the Logs tab in the Diagnostic Monitor in ArcGIS Pro (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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.