Sort
Sorts items by one or more fields in ascending or descending order.
Overview
The Sort node reorders workflow items by field values. You can sort by multiple fields — items are sorted by the first field, then ties are broken by the second field, and so on.
Use it to:
- Rank items by a numeric field
- Order data alphabetically
- Get the top or bottom N items when combined with Limit
- Ensure consistent ordering before export
Parameters
| Parameter | Description | Required |
|---|---|---|
| Sort By | One or more sort criteria with expressions and directions | Yes |
Sort By
Each sort criterion specifies:
| Field | Description |
|---|---|
| Value | Expression producing the sort key (e.g., {{$item.data.amount}}) |
| Direction | Ascending (A-Z, 0-9) or Descending (Z-A, 9-0). Default: Ascending |
Add multiple criteria for multi-key sorting. Items are sorted by the first criterion, then ties are broken by subsequent criteria.
Output
The same items as input, reordered according to the sort criteria. No fields are added or removed.
Input:
[
{ "name": "Charlie", "score": 85 },
{ "name": "Alice", "score": 92 },
{ "name": "Bob", "score": 85 }
]
Sort By: score DESC, name ASC
Output:
[
{ "name": "Alice", "score": 92 },
{ "name": "Bob", "score": 85 },
{ "name": "Charlie", "score": 85 }
]
Examples
Top 10 by Amount
Get the highest-value items:
[Get Table] → [Sort (amount DESC)] → [Limit (10)] → [Export to Excel]
Sort by Date, Then Name
[Get Table] → [Sort (date ASC, name ASC)] → [Insert Rows]
Alphabetical Report
[Get Table] → [Sort (category ASC, name ASC)] → [Export to CSV]
Tips
- Sort collects all items before producing output (similar to Aggregate)
- Null/undefined values always sort to the end, regardless of direction
- Numeric values are compared numerically; strings are compared alphabetically
- Combine with Limit to efficiently get top/bottom N items
- Multiple sort criteria are evaluated in order — first criterion takes priority