【发布时间】:2020-07-10 05:47:14
【问题描述】:
我是 mulesoft 的新手,并且已经编写了 dataweave 来迭代订单项(xml 中的 product-lineitem)。但是,它不起作用,它只插入一个订单行项目,(订单行项目-product-lineitem) 有什么指点吗?
输入
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<order xmlns="http://www.demandware.com/xml/impex/order/2006-10-31" order-no="00001101">
<order-date>2020-07-09T12:55:28.663Z</order-date>
<original-order-no>00001101</original-order-no>
<product-lineitems>
<product-lineitem>
<product-id>65754</product-id>
</product-lineitem>
<product-lineitem>
<product-id>65755</product-id>
</product-lineitem>
</product-lineitems>
</order>
数据编织
%dw 2.0
output application/java
ns ns0 http://www.demandware.com/xml/impex/order/2006-10-31
---
[{
Order_Confirmation_Number__c: payload.ns0#order.ns0#"current-order-no",
"attributes": {
"type": "PBSI__PBSI_Sales_Order__c",
"referenceId": "SO"
},
"PBSI__Sales_Order_Lines__r": {
"records": payload.*ns0#order.ns0#"product-lineitems" map((e,empindex) -> {
"attributes": {
"type": "PBSI__PBSI_Sales_Order_Line__c",
"referenceId": "SOL"
},
"PBSI__Item__c": "a0a1x000001PfWa",
"PBSI__ItemDescription__c": e.ns0#"product-lineitem".ns0#"product-id"
})
}
}]
【问题讨论】: