Measure Component

Function

a!measure( field, function, alias, label )

Determines the numerical values to display on a query or chart. The measure should incorporate a record field or a related record field, the appropriate calculation to run on the field, and an alias.

This configuration is used when a record type is defined as the data source for a chart or query. This function can be within the measure parameter in a bar, column, line, or pie chart or a query with records.

The a!measure() function must be used inside one of the following:

  • a!barChartConfig()
  • a!columnChartConfig()
  • a!lineChartConfig()
  • a!pieChartConfig()
  • a!aggregationFields().

See also:

Parameters

Name Keyword Types Description

Field

field

Any Type

The record field or related record field to use in this calculation, configured using the recordType! domain. For example, recordType!Case.fields.status.

Function

function

Text

Function to use with calculations on the field provided. Accepts "COUNT", "SUM", "MIN", "MAX", "AVG".

Alias

alias

Text

The short name by which the result of the measure field can be referenced in other places in the chart configuration or a!queryRecordType().

Label

label

Text

Text to display in the legend or tooltip when using the measure in a chart. If no label is defined, the label displays with the function name and field name. The label only displays if a single grouping is used on a bar, column, or line chart. This parameter is ignored when used in a!queryRecordType().

Usage considerations

Using the field, function, and sort parameters

  • The field and function parameters are required. The field parameter also must reference a record field or a related record field from the record type specified in the query or chart.
  • If an alias is provided, it can be used as the field in the sort parameter within the parent configuration function.

Count and mathematical functions

  • The functions SUM, MIN, MAX, and AVG can only be used with fields of type integer or decimal.
  • When using a!measure() in a query, the alias is required.
  • If no measure is provided in a chart, by default the chart will display as a count of the primary key field.

Using the label parameter

  • The label determines the text label displayed in the legend or tooltip for the measure when used in a chart. This parameter is ignored when used in a!queryRecordType. If no label is provided, the default label displays with the function and field name, such as Count of id. The label does not apply when used with a secondary grouping, as the label is then determined by the secondary grouping field value. Also, the label does not apply when using a measure in a pie chart.

The following patterns include usage of the Measure Component.

Open in Github Built: Tue, May 23, 2023 (06:12:33 PM)

On This Page

FEEDBACK