%dw 2.0
output application/json
---
{
"chainResult": ["mariano", "de Achaval"]
reduce ((item, accumulator) -> item ++ accumulator)
then ((result) -> sizeOf(result)),
"referenceResult" : ["mariano", "de Achaval"]
map ((item, index) -> upper(item))
then {
name: $[0],
lastName: $[1],
length: sizeOf($)
},
"onNullReturnNull": []
reduce ((item, accumulator) -> item ++ accumulator)
then ((result) -> sizeOf(result))
}
then
then(value: Null, callback: (previousResult: Nothing) -> Any): Null
Helper function that enables then to work with a null value.
Introduced in DataWeave version 2.4.0.
then<T, R>(previous: T, callback: (result: T) -> R): R
This function works as a pipe that passes the value returned from the
preceding expression to the next (a callback) only if the value returned
by the preceding expression is not null.
Introduced in DataWeave version 2.4.0.
Parameters
| Name | Description |
|---|---|
|
The value of the preceding expression. |
|
Callback that processes the result of |
Example
This example shows how to use then to chain and continue processing
the result of the previous expression.



