Select to view content in your preferred language

Return a GroupedBy result AND additional fields not in GroupedBy expression?

1036
2
Jump to solution
03-10-2023 09:06 AM
Labels (1)
M_M
by
Occasional Contributor

Hello,

I would like to add a table to my Dashboard containing a bunch of GroupedBy results.  However, I'd also like to have some fields in the table that are not currently in the GroupedBy expression.  I guess they could be added to the GroupedBy and still make sense, but I don't have a Statistic for them as it would be 'username' and 'date' etc., and I don't know how to write them into the grouped by without a statistic.  

Also, once the table is added to Dashboard, is it possible to assign an Action to zoom to feature in map when a row is selected in the table?

  • Data is being grouped by a polygon name (Stand#) 
  • The only thing I could come up with was mess with the Actions on the table and a Category Selector created to filter by Stand#.  Select row on table then go to filtered Category selector where it will zoom to map.  Not very efficient. 🙂 

Thank you!!! 

Melissa

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

You can kind of do this. By adding your extra fields to the "groupby fields" parameter, you'll get your data grouped per stand / user / date combination.

GroupBy(
    your_featureset,
    ['Stand_number', 'username', 'date_field'],
    [{your statistic expressions}]
)

 To retain geometry, though, that can't be done unless you use a loop.

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
2 Replies
GregKeith
Frequent Contributor

I don't believe you can have an expression where some fields are grouped and others are not. I know you can't do this in SQL. The underlying set theory doesn't make it possible. All fields have to be aggregated in some way. Since the Group By returns a single result per field, it doesn't make sense to then also have a field(s) that contain multiple values.

You can (potentially) perform aggregation on fields within a record in the SELECT clause, e.g. averaging the sum of three numeric fields, and include other fields, but not across records.

0 Kudos
jcarlson
MVP Esteemed Contributor

You can kind of do this. By adding your extra fields to the "groupby fields" parameter, you'll get your data grouped per stand / user / date combination.

GroupBy(
    your_featureset,
    ['Stand_number', 'username', 'date_field'],
    [{your statistic expressions}]
)

 To retain geometry, though, that can't be done unless you use a loop.

- Josh Carlson
Kendall County GIS
0 Kudos