Free cookie consent management tool by TermsFeed

a!measure_26r9 Component

On This Page

This page contains information related to an old version of the Measure Component.

To take advantage of the latest features and improvements, we always recommend you use the latest version whenever possible. See the latest version's page for information about what's been changed.

Function

Determines the numerical values to display on a query, chart, or KPI. The measure should incorporate a record field or a related record field, the appropriate calculation to run on the field, and an alias. You can also apply filters to determine which values are included in the calculation.

This configuration is used when a record type is defined as the data source for a chart, KPI, or query. This function can be in:

  • The measure parameter in a bar, column, line, or pie chart.
  • The primaryMeasure and secondaryMeasure parameters in a KPI.
  • A record type query.

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", "DISTINCT_COUNT".

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().

Filter

filters

Any Type

A single, logical expression or a list of query filters to filter the record set. Queries also apply the default filters defined on the referenced record type.

Format value

formatValue

Text

Display value for the given measure value. Only applies when the measure is used in a records-powered chart. Valid formats are "AUTO" (default), "INTEGER", "DECIMAL", "DOLLAR", "EURO", "POUND", "YEN", "SWISS_FRANC", or a custom format defined with text(). For a custom format, you can reference the unformatted result from the data source using fv!value. The display format does not affect the values used in the calculations for the chart; it is only used for display.

Usage considerations

Using the field and function 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, chart, or KPI.
  • If no measure is provided in a chart, by default the chart will display as a count of the primary key field.

Count and mathematical functions

  • The functions SUM, MIN, MAX, and AVG can only be used with fields of type integer or decimal.
  • The function DISTINCT_COUNT is only supported with entity-backed or synced record types.
  • The COUNT function will count the total number of values in a record field, whereas the DISTINCT_COUNT function will only count the unique values in a record field.

    For example, say you want to count the number of customers who've placed an order. Since one customer can place many orders, the COUNT function would count the same customer twice; however, the DISTINCT_COUNT function will only count that customer once, even if they've placed multiple orders.

Using the alias parameter

  • You must provide an alias when using a!measure_26r9() in a query.
  • An alias is optional when using a!measure_26r9() in a chart.
  • To sort by measure results in a query, reference the alias in the sort parameter of the parent configuration function. See an example sorting by an alias in a query.

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 or a KPI component.
  • 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.

Using the filters parameter

  • The filters parameter can be used to determine which values are included in the calculation specified in the field and function parameters.

  • You can filter on a record field or a related record field, and the field reference must start from the aggregated record type.

    For example, you have a Customer record type that has a one-to-many relationship with the Order record type. In a report, you want to calculate the number of orders for each customer that include the order item "Printer". Since you're aggregating on the Order record type, the field reference in the filter must start from recordType!Order.

    The a!measure_26r9 function would look something like this:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    a!measure_26r9(
      function: "COUNT",
    ! field: recordType!Customer.relationships.orders.fields.id,
      alias: "count_of_id",
      /* Since the Order record type is the related record type used in the field parameter, 
      we'll use that record type reference in the filter.*/
      filters: {
        a!queryFilter(
    !   field: recordType!Order.relationships.orderItem.fields.itemName,
        operator: "=",
        value: "Printer"
          )
        }
      )
    
  • When you filter on a field from a related record type in a one-to-many relationship (the "many" side of the relationship), the filter returns all records from the base record type (the "one" side of the relationship) that have at least one related record that meets the filter condition.

    For example, an order can have many order items. So using the filter above, the aggregation will count all customer orders that have at least one order item called "Printer".

Using the formatValue parameter

The formatValue has several predefined options to make the numbers on your records-powered chart or KPI easier to read and understand. You can also customize the formatting to make your data more meaningful to users.

For example, your app may have a chart showing the average monthly temperature in each US state. If this data is stored in a record field as a Number (Decimal Precise) or Number (Decimal Floating), the "AUTO" option lists each value as an unformatted number.

Chart showing automatic measure data formatting

You can customize the formatting to indicate temperature by concatenating each value with the degree symbol and unit of measure.

1
text(fv!value, fv!value & " " & char(176) & "F")

Chart showing custom measure formatting for temperature data

Measures on charts

  • If you use a bar, column, or line chart, you can display multiple measures if no Secondary Grouping field is provided. See Chart Configuration Using Records for more information on how to add measures to charts.
  • You can select a predefined or custom format value to change how the measure data is displayed on the chart. See Using format values for more information.

Measures on KPIs

Measures are used in two of the KPI component's parameters: primaryMeasure and secondaryMeasure. Together, these parameters let you display data trends and extract greater value from the metrics captured in your record data. The values created for these parameters can be referenced in other KPI parameters as fv!primaryMeasure and fv!secondaryMeasure. See KPI Component for more information.

Examples

Record type references are specific to each environment. If you copy and paste these examples into your interface, they will not evaluate. Use them as a reference only.

Use a!measure_26r9 and a!grouping in a query

This expression returns the three customers with the most orders. To return this value, a grouping and a measure is included in the a!aggregationFields() function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
a!queryRecordType(
  recordType: recordType!RE Customer,
  fields: a!aggregationFields(
    groupings: {
    /* Group by customer name */
      a!grouping(
        field: recordType!RE Customer.fields.displayName,
        alias: "customer"
      )
    },
    measures: {
    /* Count orders for each customer */
      a!measure_26r9(
        field: recordType!RE Customer.relationships.order.fields.id,
        function: "COUNT",
        alias: "orderCount"
      )
    }
  ),
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 3,
    sort: {
      /* Use the measure alias to sort by the count of orders */
      a!sortInfo(
        field: "orderCount",
        ascending: false
      )
    }
  )
).data

The expression returns the following:

1
2
3
4
5
6
7
8
9
10
List of Map - 3 items
  Map
    customer: "Pearle Dybald" (Text)
    orderCount: 26 (Number (Integer))
  Map
    customer: "Cazzie Paoli" (Text)
    orderCount: 24 (Number (Integer))
  Map
    customer: "Sandro Jarley" (Text)
    orderCount: 24 (Number (Integer))

Use a!measure_26r9 in a query

This expression returns the total number of orders in the RE Order record type. To return this value, only a measure is included in the a!aggregationFields() function.

1
2
3
4
5
6
7
8
9
10
11
12
13
a!queryRecordType(
  recordType: recordType!RE Order,
  fields: a!aggregationFields(
    measures: {
      a!measure_26r9(
        field: recordTypeRE Order.fields.id,
        function: "COUNT",
        alias: "orderCount"
      )
    }
  ),
  pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100)
).data

The expression returns the following:

1
2
3
List of Map - 1 item
  Map
    orderCount: 4748 (Number (Integer))

Use a!measure_26r9 in a chart

This expression create a pie chart that counts the number of employees in each department. Charts require both a grouping and a measure.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
a!pieChartField(
  label: "Employees by Department",
  labelPosition: "COLLAPSED",
  data: recordType!AT Employee,
  config: a!pieChartConfig(
    primaryGrouping: 
    /* Group by department */
      a!grouping(
        field: recordType!AT Employee.relationships.department.fields.value,
        alias: "department"
      ),
    measures: {
    /* Count employees in each department */
      a!measure_26r9(
        field: recordType!AT Employee.fields.id,
        function: "COUNT",
        alias: "employeeCount"
      )
    },
    dataLimit: 100
  ),
  refreshAfter: "RECORD_ACTION",
  allowImageDownload: true,
  height: "MEDIUM",
  colorScheme: "RAINFOREST",
  style: "DONUT",
  seriesLabelStyle: "ON_CHART"
)

The expression returns the following:

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeimages/pieChart-grouping-measure-ex.png

Feature compatibility

The table below lists this component's compatibility with various features in Appian.
Feature Compatibility Note
Portals Compatible
Offline Interfaces Compatible
Sync-Time Custom Record Fields Incompatible
Real-Time Custom Record Fields Incompatible

Custom record fields that evaluate in real time must be configured using one or more Custom Field functions.

Process Reports Incompatible

Cannot be used to configure a process report.

Process Events Incompatible

Cannot be used to configure a process event node, such as a start event or timer event.

Process Autoscaling Incompatible

Cannot be used in autoscaled processes.

Event Consumer Filter Conditions Compatible

Can be used in filter conditions.

Event Consumer Event Handlers Compatible

Can be used in event handler expressions.

Feedback