I am new to dataweave language. Could you please help to solve this syntax error "Invalid input "otherwise (", expected is, *, <=, <, >=, as, or,
, ~=, -, functionCall, ==, fullAttributes, +, !=, :, and, / or >" at first occurence of word "otherwise' below.
%dw 1.0
%output application/json
---
{
ref:[{
captureDetails : {
captureSource : "aa",
captureDate : ""
},
effectiveDate : "",
expiryDate : "",
preferenceLevel : "customer",
sourcePreferenceCode: {
(( preferenceCode: "A1" ) when trim payload.key == "REF1"
otherwise (
( preferenceCode: "A2" ) when trim payload.key == "REF2"
otherwise (
( preferenceCode: "A3" ) when trim payload.key == "REF3"
otherwise (
( preferenceCode: "A4" ) when trim payload.key == "REF4"
otherwise (
( preferenceCode: "A5" ) when trim payload.key == "REF5"
otherwise (
( preferenceCode: "A6" ) when trim payload.key == "REF6"
otherwise (
( preferenceCode: "A7" ) when trim payload.key == "REF7"
otherwise (
( preferenceCode: "A8" ) when trim payload.key == "REF8"
otherwise ( preferenceCode: "" )
)
)
)
)
)
)
)
),
preferenceValue: trim payload.value
},
}],
lastUpdateDetails:{
lastUpdateId:"adam",
lastUpdateTimestamp:"2019-07-19",
lastUpdateFunction:"U",
lastUpdateChannel : "P"
}
}