list replace
FEEL built-in function · FEEL list functions
list replace(list, position | match, newItem)
Returns a new list with the element at the position, or every element accepted by the matcher function, replaced by newItem.
Parameters
| Parameter | Type | Description |
|---|---|---|
| list | list | the source list |
| position | match | number or function | 1-based position, or a matcher function of (item, newItem) |
| newItem | any | the replacement value |
Examples
list replace([2, 4, 7, 8], 3, 6)
[2, 4, 6, 8]
Try it ↑
list replace([2, 4, 7, 8], function(item, newItem) item > 5, 0)
[2, 4, 0, 0]
Try it ↑
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).