Sort
Sorts a list of items by one or more fields, or sorts a list of plain values.
Parameters
| Name | Required | Default | Description |
|---|---|---|---|
Items (input) | Yes | — | The array to sort, e.g. {{ $nodes['Fetch Orders'].items }}. |
Sort by (sortBy) | No | The items themselves | Comma- or newline-separated field paths. Add asc or desc after a field to override the default direction, e.g. lastName, age desc. |
Default direction (direction) | No | Ascending | asc or desc, used for fields without their own direction. |
Case-sensitive text (caseSensitive) | No | false | When off, apple and Apple sort together. |
Ordering rules
- Numbers sort numerically. Text that looks like a number also sorts numerically when compared with other numeric text (
"2"before"10"). - Other text sorts alphabetically (ordinal).
- Missing /
nullvalues come first in ascending order (last in descending). - The sort is stable: items with equal keys keep their original order.
ISO 8601 date strings (e.g. 2026-03-01T09:00:00Z) sort correctly as text.
Ports
| Port | Description |
|---|---|
main (input) | The step(s) Sort runs after. |
output | { items, count } |
Example
Sort customers by country, then by highest spend first:
- Items:
{{ $nodes['Get Customers'].items }} - Sort by:
country, totalSpend desc
{
"items": [
{ "name": "Lena", "country": "DE", "totalSpend": 900 },
{ "name": "Ada", "country": "GB", "totalSpend": 1200 },
{ "name": "Alan", "country": "GB", "totalSpend": 300 }
],
"count": 3
}
Combine with Limit to get a "top N".
Notes
- Items must resolve to an array (a single value is a one-item list; an empty value an empty list). Stored files must be parsed first.