Data Aggregation: General Information

You can group data on a form by adding an aggregation clause to the query that is used to retrieve data for the form.

Learning Objectives

In this chapter, you will learn how to add an aggregation clause and function to display aggregated data.

Applicable Scenarios

You group or aggregate data in the following cases:

  • You need to display the maximum or minimum value for a group of records.
  • You need to display the sum of values for a group of records.
  • You need to display the average value for a group of records.
  • You need to display the number of records in a group.

Data Aggregation

To group or aggregate records, you append the AggregateTo<> clause to the statement that is defining a query. You can specify the grouping condition and the aggregation function by using the GroupBy clause and the appropriate aggregation function. To calculate a value for each group, you can use any of the following aggregation functions: Min, Max, Sum, Avg, and Count.

For details on the use of aggregation functions, see To Select Records by Using Fluent BQL or To Group and Aggregate Records in Traditional BQL. You can find equivalents between aggregation functions in fluent BQL and those in traditional BQL in Fluent BQL and Traditional BQL Equivalents.