FunctionCopy link to clipboard
a!sortInfo( field, ascending )
Creates a value of type SortInfo for use with grids and record queries.
See also:
ParametersCopy link to clipboard
Keyword | Type | Description |
---|---|---|
|
Any Type |
The name of the field used to sort by. When sorting record data, use the |
|
Boolean |
Determines what order the data is sorted in. Sorted in ascending order when the value is |
ReturnsCopy link to clipboard
SortInfo
Usage considerationsCopy link to clipboard
Supported data typesCopy link to clipboard
Sorting is only supported for complex data types and is not supported for a dictionary array.
Sorting in a!queryRecordType vs a!queryEntityCopy link to clipboard
Depending on the type of query, the way you reference the sort field will vary.
If you are sorting in a!queryRecordType()
, you must use a record field reference.
For example:
1
2
3
4
a!sortInfo(
field: recordType!Customer.fields.sumOfSales,
ascending: false
)
Copy
If you are sorting in a!queryEntity()
, you must reference the field by name in quotations.
For example:
1
2
3
4
a!sortInfo(
field: "lastName",
ascending: false
)
Copy
Sorting on related record data from a one-to-many relationshipsCopy link to clipboard
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.
Sorting on aggregated data in a queryCopy link to clipboard
When an alias is defined in the grouping or measure of your query, you must use the alias instead of the record 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
Copy
Sorting on records-powered chartsCopy link to clipboard
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.
ExampleCopy link to clipboard
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()
)
Copy
Returns
1
2
[field=name,
ascending=true]
Copy
For more examples, see Query Recipes
Feature compatibilityCopy link to clipboard
The table below lists this function's compatibility with various features in Appian.
Feature | Compatibility | Note |
---|---|---|
Portals | Compatible | |
Offline Mobile | 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 | Compatible |