我会让代码来解释。
Dataweave给出了错误:
无法解析何时引用
无法解析否则的引用
输入消息:一个对象数组。虽然我在这里只给出了一个物体。
[{
"Field1" : 12345,
"field2" : 10
}]%dw 2.0
output application/json
---
payload map {
"test" : $.Field1 when $.field2 >= 1 otherwise ""
}发布于 2020-05-05 13:06:50
在DW2.0中没有<expression> when <condition> otherwise <expression>。使用if (condition) <then_expression> else <else_expression>代替。
因此,您的代码如下:
%dw 2.0
output application/json
var data = [{
"Field1" : 12345,
"field2" : 10
}]
---
data map {
test : if ($.field2 >= 1) $.Field1 else ""
}https://stackoverflow.com/questions/61613792
复制相似问题