HOME COMMUNITY BLOG

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt
This field type allows you to create a calculated total field , using an aggregation function.
 

Attributes

RelationSpecifies a relation to an entity , of which that contains the fields you want to summarize using an aggregation function.
AggregationTypeIndicates the aggregation function. Possible values are:
  • Count

  • Sum

  • Average

  • Minimum

  • Maximum

FieldSpecifies 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 aggregated expressionaggregate 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 it the aggregation will recalculate the aggregation. 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:

RelationInvoiceDetail
AggregationTypeSum
FieldPrice

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