DynamicWhere.ex
DynamicWhere.exv2.1.0·docs

GroupBy

A GroupBy defines the group-key fields and the list of aggregations to compute for each group. It is the required member of every Summary.

Properties

PropertyTypeDescription
FieldsList<string>Properties to group by (must be simple types — no collections, no complex types).
AggregateByList<AggregateBy>Aggregations to compute per group.
Field restrictions
Group keys must be simple value types — string, numbers, booleans, enums, dates, etc. Collections and complex/navigation types cannot be grouped on.

C# example

var groupBy = new GroupBy
{
    Fields = new List<string> { "Country", "Status" },
    AggregateBy = new List<AggregateBy>
    {
        new AggregateBy { Aggregator = Aggregator.Count, Alias = "Total" },
        new AggregateBy { Field = "Amount", Aggregator = Aggregator.Sum, Alias = "Revenue" }
    }
};

JSON example

{
  "fields": ["Country", "Status"],
  "aggregateBy": [
    { "aggregator": "Count", "alias": "Total" },
    { "field": "Amount", "aggregator": "Sum", "alias": "Revenue" }
  ]
}

See also