在数据编织1.0中合并2个Java消息时遇到问题,以下是消息的详细信息:
MESSAGE 1
STORE_NUMBER : STORE_NAME
1101 : ABC
112 : DEF
MESSAGE 2
STORE_NUMBER : STORE_OPENDATE
1101 : 20/10/2019
112 : 21/01/2019
我正在使用下面的DW代码
%dw 1.0
%output application/json
%var filterOnStoreNumber = (storeId) -> (payload filter $.STORE_NUMBER == storeId) when payload != null otherwise []
%var storeDetail = payload groupBy ($.STORE_NUMBER )
---
flowVars.storesList map ((storeNumber, storeNumberIndex) -> {
id: storeNumber.STORE_NUMBER,
details: storeDetail [storeNumber.STORE_NUMBER][0] when storeDetail != null otherwise {}
})
预期输出:
[
{
Store:1101,
Name:ABC,
details:[
{
OPENDATE:20/10/2019
}
]
},
{
Store:112,
Name:DEF,
details:[
{
OPENDATE:21/01/2019
}
]
}
]
请让我知道为了达到上述效果需要修改的内容。