Sabino Albuquerque Portela
Problem When using Aggregates, OutSystems requires that all attributes in the Output must either be included in the Group By clause or wrapped in an aggregate function (Sum, Count, Max, Min, etc.). In many scenarios, developers need to group by a single attribute but also display other attributes that are functionally dependent on that group. Currently, this forces developers to either: Add unnecessary fields to the Group By (which can negatively impact performance and change result granularity), or Use artificial aggregations like Max() or Min() just to expose the attribute in the output. This creates unnecessary complexity and may lead to confusion or performance issues. Impact More complex and less readable queries Potential performance degradation due to excessive grouping Workarounds that do not represent the developer’s actual intent Additional learning curve for new developers Expected BehaviorAllow Aggregates to output attributes that are functionally dependent on grouped attributes without requiring them to be included in Group By or wrapped in artificial aggregation functions. Possible approaches could include: Automatic detection of functional dependencies (e.g., attributes from 1-to-1 relationships) A configuration option to mark attributes as dependent on grouped fields More flexible output configuration in Aggregates Use Case ExampleGrouping orders by CustomerId while displaying customer attributes (Name, Email) that are uniquely determined by CustomerId, without requiring extra grouping or artificial aggregation. Business Value Better performance practices Cleaner and more intuitive queries Improved developer experience Reduced need for workarounds