Mulesoft条件语句

时间:2020-07-29 11:42:55

标签: dataweave mulesoft

我有一个XML,我想在Dataweave中检查XML中是否存在re.setIsActive(tt.isActive()); re.setCbDate(LocalDate.parse(tt.getCobDate())); re.setCreatedDate(LocalDate.now()); 标记,该怎么做?

<custom-attribute attribute-id="sscAccountid">0011x0000152nlyAAA</custom-attribute>

1 个答案:

答案 0 :(得分:0)

我了解您想确认具有示例结构的XML有效负载是否具有order.custom-attributes.custom-attribute元素,且其属性attribute-id等于“ sscAccountid”。

%dw 2.0
output application/json
fun hasAccountId(x) =sizeOf(x.order.'custom-attributes'  filterObject ($.@'attribute-id' == "sscAccountid") ) > 0
---
hasAccountId(payload)

输入XML的输出:

true