a!sortInfo() Function
This function cannot be used with Custom Record Field Expressions.
For a full list of functions and their feature compatibility, explore the Appian Functions table.

Function

a!sortInfo( field, ascending )

Creates a value of type SortInfo for use with grids and record queries.

See also: SortInfo, Read-Only Grid, a!queryRecordtype, a!relatedRecordData(), a!pagingInfo()

Parameters

Keyword Type Description

field

Any Type

The name of the field used to sort by. When sorting record data, use the recordType! domain to reference a record field or related record field. For example, recordType!Case.fields.caseName. When sorting on aggregate data, you must use the alias as the sort field if an alias is defined in the groupings or measures.

ascending

Boolean

Determines what order the data is sorted in. Sorted in ascending order when the value is true and descending order when the value is false. Default: false.

Returns

SortInfo

Usage considerations

Supported data types

Sorting is only supported for complex data types and is not supported for a dictionary array.

Sorting on aggregated data in a query

When an alias is defined in the grouping or measure of your query, you must use the alias instead of the recored field reference as the sort field.

For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
a!queryRecordType(
  recordType: recordType!Case,
  fields: a!aggregationFields(
    groupings: a!grouping(
      field: recordType!Case.fields.createdon,
      interval: "DATE_SHORT_TEXT"
!     alias: "createdOn",
    ),
    measures: a!measure(
      field: recordType!Case.fields.id,
      function: "COUNT",
      label: "# of cases",
      alias: "caseCount"
    )
  ),
  pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 500,
!   sort: a!sortInfo(field: "createdOn", ascending: true)
  )
).data

Sorting on records-powered charts

To sort your chart data, you can:

  • Use the alias of any groupings or measures to sort by fields referenced in the chart.
  • Use a record field or related record field reference to sort by fields that are not referenced in the chart. The field must be of type Number (Integer), Number (Decimal), Date, Date and Time, Time, or Boolean.

You can add multiple sort fields on line, bar, and column charts that uses a record type as the source.

See Configure Charts Using Records for more information on sorting records-powered charts.

When applying a sort to the a!relatedRecordData() function, you must reference record fields or related record fields from the related record type specified in the relationship parameter of the function.

See Filtering and sorting the related record set for more information.

Examples

You can copy and paste these examples into the Expression Rule Designer to see how this works.

1
2
3
4
	=a!sortInfo(
	  field: "name",
	  ascending: true()
	)

Returns

1
2
	[field=name,
	 ascending=true]
Open in Github Built: Tue, Jun 28, 2022 (02:37:41 PM)

On This Page

FEEDBACK