Aggregated Field

This field type allows you to create a calculated total field using an aggregate function.

Attributes

Relation Specifies a relation to an entity that contains the fields you want to summarize using an aggregate function.
AggregationType Indicates the aggregate function. Possible values are:
  • Count

  • Sum

  • Average

  • Minimum

  • Maximum

Field Specifies on which column from the entity specified in the Relation attribute the aggregation will occur.

How It Works

Aggregated fields behave differently depending on how you design your data structure.

Static Aggregation

If your data structure only contains the entity with the aggregated field but not the child entity from which the aggregation is calculated, then the data will be selected on the database level using an SQL aggregate function.

Dynamic Aggregation

But you can also include the child entity in the target data structure.

E.g.

  • Invoice
    • InvoiceDetail

In that case, the aggregation will be calculated in memory and on each change in the detail entity the aggregation will recalculate. This way the user will see the recalculated total automatically after he changes the detail data.

Example

You want to create a total field InvoiceTotal in an entity Invoice. This field should give a summary of all Price fields in the InvoiceDetail entity.

To do this, you create an aggregated field in the Invoice entity. It will have the following attributes:

Relation InvoiceDetail
AggregationType Sum
Field Price

This field will then display a total price on the invoice level automatically.