DynamicWhere.ex
DynamicWhere.exv2.1.0·docs

GroupBy Validation

A GroupBy shape is heavily validated because both the group keys and the aggregations feed the generated SQL GROUP BY / SELECT clauses.

Rules

RuleError Code
Must have at least one fieldGroupByMustHaveFields
Fields must be unique (case-insensitive)GroupByFieldsMustBeUnique
Fields cannot be complex/navigation typesGroupByFieldCannotBeComplexType
Fields cannot be collection typesGroupByFieldCannotBeCollectionType
Aggregation alias must not be empty and must not contain dotsInvalidAlias
Aggregation aliases must be uniqueAggregationAliasesMustBeUnique
Aggregation alias cannot match a GroupBy fieldAggregationAliasCannotBeGroupByField({alias})
Aggregation field must be a simple typeAggregationFieldMustBeSimpleType
Aggregation field cannot be a collectionAggregationFieldCannotBeCollectionType
Sumation / Average only work on numeric fieldsUnsupportedAggregatorForType({agg},{type})
Minimum / Maximum do not work on BooleanUnsupportedAggregatorForType({agg},{type})
Note
Dotted GroupBy fields like Category.Name are allowed if the leaf is a simple type. Only the leaf is the actual key; the dotted path is flattened into an alias such as CategoryName in the result. See the Summary example.