'Inputs on converting Mule 3 expression to a Mule 4 expression
We are migrating a Mule 3 application to Mule 4 using the Mule Migration Assistant (MMA). While migrating encountered below code which can not be migrated automatically.
Any inputs on how to manually convert this to Mule 4?
Please note: Need only the syntax as we are not aware of the input or required output.
mel:appendix.get(propertyKey).get(payload.getValue()) != null ? payload.setValue(appendix.get(propertyKey).get(payload.getValue())) : payload.setValue(payload.getValue())
Solution 1:[1]
I can't be sure this will work with whatever Java class payload has but a DataWeave equivalent could be:
%dw 2.0
output application/json
var propertyKey="key2"
var appendix={key1:{a: 10, b: 20, c: 30, d: 40}, key2: {a: 50, b: 60, c: 70, d: 80}}
---
payload update {
case .value if (appendix[propertyKey][payload.value] != null) -> appendix[propertyKey][payload.value]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | aled |
