Grouping Component

Function

Determines the fields to group by in a query or chart that uses a record type as the source. The grouping should incorporate a record field or a related record field, an alias, and an optional interval to group by a date.

This configuration is used when a record type is defined as the data source for a chart or when using a!queryRecordType(). This function can be used as a primary grouping or secondary grouping in a bar, column, line, or pie chart or to define the fields in a query using a!aggregationFields().

See also:

Parameters

Name Keyword Types Description

Field

field

Any Type

The record field or related record field to group by. Use the recordType! domain to reference the field. For example, recordType!Case.fields.status.

Interval

interval

Text

The date or time interval to group by. This parameter can only be used when the field is of type Date, Date and Time, or Time. Valid values: "AUTO" (default), "YEAR", "MONTH_OF_YEAR", "MONTH_OF_YEAR_SHORT_TEXT", "MONTH_OF_YEAR_TEXT", "MONTH_TEXT", "MONTH_SHORT_TEXT", "MONTH_DATE", "DATE", "DATE_SHORT_TEXT", "DATE_TEXT", "DAY_OF_MONTH", "HOUR_OF_DAY", "HOUR", "MINUTE_OF_HOUR", "MINUTE".

Alias

alias

Text

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

Format Value

formatValue

Any Type

Display value for the given grouping value. Only applies when the grouping is used in a chart. This parameter is evaluated once for each value returned. You can reference the unformatted result from the data source using fv!value. This display value does not affect the values used in calculations for the chart; it is only used for display.

Usage considerations

Interval

The interval determines how to group data for fields of type Date, Date and Time, or Time. Each interval can combine data from multiple dates for easy reporting. For example, suppose you have three records with the following values for the startDate field: March 17, 2021; March 28, 2021, and April 3, 2021. If you use the MONTH_TEXT interval, it will group the data together and return the values as March 2021 and April 2021.

In addition to grouping the data, the interval can also provide localized date formats in some cases. For example, the MONTH_OF_YEAR interval returns the month number, a value 1-12. The MONTH_OF_YEAR_TEXT interval also groups the data by month, but it returns the text value of the month, such as January. The value returned for the interval will vary based on the locale of the user who runs the query. If you need to ensure the value is the same across all locales (for example, to use the result in a filter), use one of the intervals that does not contain the word TEXT.

By default, the AUTO interval is selected. This interval does not perform any additional grouping, so the original value will be returned.

See the table below for the results using each interval:

Grouping Interval Valid Data Types Return Type Localized? Sample Value Sample Result
AUTO Any Type Any Type No 10/17/2021 3:45:12 PM 10/17/2021 3:45:12 PM
YEAR Date and Time; Date Integer No 10/17/2021 2021
MONTH_OF_YEAR Date and Time; Date Integer No 10/17/2021 10
MONTH_OF_YEAR_SHORT_TEXT Date and Time; Date Text Yes 10/17/2021 Oct
MONTH_OF_YEAR_TEXT Date and Time; Date Text Yes 10/17/2021 October
MONTH_DATE Date and Time; Date Integer No 10/17/2021 10/1/2021
MONTH_SHORT_TEXT Date and Time; Date Text Yes 10/17/2021 Oct 2021
MONTH_TEXT Date and Time; Date Text Yes 10/17/2021 October 2021
DATE Date and Time; Date Date No 10/17/2021 3:45 PM 10/17/2021
DATE_SHORT_TEXT Date and Time; Date Text Yes 10/17/2021 3:45 PM Oct 17, 2021
DATE_TEXT Date and Time; Date Text Yes 10/17/2021 3:45 PM October 17, 2021
DAY_OF_MONTH Date and Time; Date Integer No 10/17/2021 3:45 PM 17
HOUR_OF_DAY Date and Time; Time Integer No 10/17/2021 3:45 PM 15
HOUR Date and Time Date and Time No 10/17/2021 3:45 PM 10/17/2021 3:00 PM
MINUTE_OF_HOUR Date and Time; Time Integer No 10/17/2021 3:45:12 PM 45
MINUTE Date and Time Date and Time No 10/17/2021 3:45:12 PM 10/17/2021 3:45:00 PM

Using the field and alias parameters

  • The field is a required parameter. It must reference a record field or a related record field from the record type specified in the query or chart.
  • When using a!grouping in a query, an alias is required.
  • If an alias is provided, it must be used as the field in the sort parameter within the parent configuration function.

Formatting values

  • When using formatValue, the expression provided will execute for each unique value returned for the grouping. See Chart Configuration Using Records for more information on how to set up the format value.

Grouping in charts

  • If you use a bar, column, or line chart, you can display a Primary and Secondary Grouping if there is only one Measure provided. See Chart Configuration Using Records for more information on how to add groupings to charts.
  • When the interval parameter is set to any value other than "AUTO", you can show time intervals with no data on the axis of your bar, column, and line charts using the showIntervalsWithNoData parameter.

Feature compatibility

The table below lists this SAIL component's compatibility with various features in Appian.
Feature Compatibility Note
Portals Incompatible
Offline Mobile Incompatible
Custom Record Field Expressions Incompatible
Process Reports Incompatible

You cannot use this function to configure a process report.

Process Events Incompatible

You cannot use this function to configure a process event node, such as a start event or timer event.

The following patterns include usage of the Grouping Component.

  • Aggregate Data and Conditionally Display in a Chart or Grid (Reports, Charts, Query Data, Grids, Records): Aggregate data and conditionally display it in a pie chart or grid. In this pattern, we will calculate the total number of employees in each department and display it in a pie chart and a read-only grid. Then, we'll use a link field to conditionally display each component.

  • Aggregate Data and Display in a Chart (Reports, Charts, Query Data, Records): Aggregate data, specifically the total number of employees in a given department, to display in a pie chart.

  • Aggregate Data by Multiple Fields and Display in a Chart (Reports, Charts, Query Data, Records): Aggregate data by multiple fields and display it in a stacked column chart. In this pattern, we will calculate the total number of employees for each title in each department and display it in a stacked column chart.

  • Aggregate Data on a Date or Date and Time Field (Reports, Query Data, Grids, Records): Aggregate data, specifically the total number of employees by date.

  • Aggregate Data using a Filter and Display in a Chart (Reports, Charts, Query Data, Filtering, Records): Aggregate data, specifically the total number of employees for each title in the Engineering department, to display in a bar chart.

  • Configure a Chart Drilldown to a Grid (Charts, Grids, Query Data, Records): Displays a column chart with aggregate data from a record type and conditionally shows a grid with filtered records when a user selects a column on the chart.

  • Dynamically Show Sales by Product Category Compared to Total Sales (Records, Reports, Charts, Filtering): This pattern illustrates how to create an area chart that dynamically displays sales generated by product category compared to total sales over the last year.

  • Filter the Data in a Grid Using a Chart (Charts, Grids, Filtering, Records): Display an interactive pie chart with selectable sections so that a user may filter the results in a grid.

  • Percentage of Online Sales (Records, Reports, Formatting): This pattern illustrates how to calculate the percent of sales generated from online orders and display it in a gauge component.

  • Sales by Region (Records, Reports, Charts): This pattern illustrates how to create a bar chart that shows sales per sales region.

  • Total Orders Compared to Orders Purchased with Promo Codes (Records, Reports, Charts): This pattern illustrates how to create a column chart that compares the number of total orders and the number of orders that had at least one item purchased with a promo code.

  • Year-Over-Year Sales Growth (Records, Reports, Formatting): This pattern illustrates how to calculate year-over-year sales growth and display it in a KPI.

Open in Github Built: Mon, Oct 03, 2022 (01:40:05 PM)

On This Page

FEEDBACK