Aggregate data

The Aggregate data action node is used to perform aggregations on data in Data connectors. It is available in both Apps and Services.

Usage

This action node can be used when large amounts of data in the database should be aggregated (counted, summarized, averaged etc.) on database-level, i.e. without reading all the records to the Apps or Services client. You may perform filtering and grouping of the records being aggregated.

Aggregate data is suitable, for example, for Dashboards or Search pages where you want to display counts or summaries that span huge sets of data records.

Examples

In this example, no groupings or filters are applied. The chosen operator is Count, and the value should be written to the Count property of the Target Data Source. Note that the Count operator does not require a property to aggregate by. The result is one object in the data source Order aggregates (temp) with Count equal to the total number of Orders.

Properties

Property
Description

Data Connector

Select a data source of type data connector to perform aggregations on.

Selection

Define the objects to aggregate.

  • All objects

  • Filtered selection

Filter

Available when Filtered Selection is selected.

Define the filter to apply to the data connector.

Conditional Filters

Add filters that can be enabled or disabled runtime. All enabled filters will be applied in addition to the regular filter.

Sorting

Add sorting rules. The objects will be sorted before the grouping and aggregations are performed.

Target Data Source

Specify a runtime-only data source or service variable to place the resulting data in.

Operation

Select how existing objects in the Target Data Source will be treated. If the Target Data Source is a service variable the operation will be limited to Update single cardinality object.

  • Replace All Objects: Remove any existing objects before creating the objects.

  • Update single cardinality object: Update the selected property in the existing object.

  • Add to Data Source (merge duplicates): Keep any existing objects.

Group By

Only available if the Target Data Source is many-cardinality.

Optionally select one or more properties to group the data by and which property to write the group value to. This will create one aggregation per unique value of the selected property, and thus create multiple objects in the Target Data Source. Each grouping item has these properties:

  • Enabled: databind to a boolean value or set up a condition or function to enable or disable runtime. Default is true

  • Property: select which property to group the data by

  • Resolution: only available if the selected property is of type Datetime. Select which time resolution to group by, e.g., day, month or year.

  • Value: choose which property in the Target Data Source to write the grouping value to.

Aggregations

Add aggregations.

Each aggregation has these properties:

  • Enabled: databind to a boolean value or set up a condition or function to enable or disable runtime. Default is true

  • Operator: select which operator to apply in the aggregation, see the list of available operators below

  • Property: select which property to perform the aggregation on

  • Value: select which property in the Target Data Source to write the the aggregated value to

Aggregation Operators

Name
Description

Count

Returns the number of objects. It does not require the selection of a property.

Sum

Returns the sum of the values of the selected property.

Average

Returns the average value of the values of the selected property.

Max

Returns the maximum value of the selected property.

Min

Returns the minimum value of the selected property.

Population Standard Deviation

Calculates the population standard deviation of the values of the selected property. Use if the values encompass the entire population of data to be represented. Read more at https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/

Sample Standard Deviation

Calculates the sample standard deviation of the values of the selected property. Use if the values encompass a sample of a population of data from which to generalize about the population. Read more at https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/

First

Returns the first value of the selected property.

Last

Returns the last value of the selected property.

Last updated

Was this helpful?