Sort task#
A Sort puts the list of items into an order. Tasks work through the list from the top, so the order decides which file is copied first, which files a limit keeps, and how the lines of a report follow each other.
Fields#
| Field | What it does | On a new task |
|---|---|---|
| Item key | the value of each item to sort by: name, size, modified, path, url, or any other value the items carry. With or without braces. |
name |
| Direction | Ascending: A to Z, small to large, old to new. Descending: the other way. | Ascending |
| Sort Type | Text compares letter by letter. Numeric compares as numbers. |
Choose Numeric for sizes and dates. As text, 100 comes before 20.
modified is the date of last change as a number, so it sorts correctly as Numeric.
A Numeric sort by a value that is not a number on some item fails the task. Sort names as Text.
What it hands on#
All items it was given. The items its filter matches come first, sorted; the items it does not match follow behind them, in the order they had.
Uses#
| To | Sort by | Then |
|---|---|---|
| handle the oldest first | modified, Numeric, Ascending |
|
| take only the newest file | modified, Numeric, Descending |
the next task with Process first item only |
| handle 500 per run, oldest first | modified, Numeric, Ascending |
an Exclude with Limit items list count to 500 |
| send small files first | size, Numeric, Ascending |
|
| a report in the order of the names | name, Text |
|
| by a value of your own | set it on each item with a UserVariable, sort by its name |
Things to know#
- Text sorting tells capitals from small letters:
Zebracomes beforeapple. To sort without that, make a small-letter copy of the name with a UserVariable and sort by it. - Long lists. A Sort has to see the whole list. Above ten thousand items that happens on disk and takes time: see Jobs with a million items.
- A Find gives no promised order. Files come as the server lists them. If the order matters, sort.