insert before
FEEL built-in function · FEEL list functions
insert before(list, position, newItem)
Returns a new list with newItem inserted before the given position.
Parameters
| Parameter | Type | Description |
|---|---|---|
| list | list | the source list |
| position | number | 1-based position of the element to insert before |
| newItem | any | the value to insert |
Examples
insert before([1, 3], 1, 2)
[2, 1, 3]
Try it ↑
Edge cases and null handling
insert before([1, 2], 3, 9)
null
Try it ↑
The position must exist, so this cannot append. Use append.
Part of FEEL list functions: how positions, nulls and single values behave across all of them, aggregating over lists of contexts, and every function side by side.
Related functions
Defined by the OMG DMN 1.6 specification, chapter 10.3.4 (built-in functions).