Slice List
Uncontrolled node
Overview
Extract a range of items without changing the source list.
Take a portion of a list, starting at start and stopping before end. The original list is not changed.
This node is evaluated when another node needs its output. It has no run or done event.
Inputs
| Input | Type | Description |
|---|---|---|
| list | List | The list to slice. |
| start | Number | Zero-based starting index, included in the result. Defaults to 0. Negative values count back from the end. |
| end | Number | Stopping index, excluded from the result. Unset, empty or invalid values use the list length. Negative values count back from the end. |
Outputs
| Output | Type | Description |
|---|---|---|
| output | Data | The selected items as a list. An empty or non-list input currently returns empty text (""), not an empty list. |
Choosing a range
Use whole-number indices. Fractional indices are rounded down. Ranges extending beyond the list are limited to the available items. A valid non-empty input with an empty selected range returns [].
Examples
For list: ["a", "b", "c", "d"]:
| Start | End | Output |
|---|---|---|
0 | 2 | ["a", "b"] |
2 | Unset | ["c", "d"] |
-2 | Unset | ["c", "d"] |
1 | -1 | ["b", "c"] |
3 | 1 | [] |
If the source can be empty, check the result before passing it to a node that requires a list.