如何解决我如何根据 mulesoft 数据编织中的列值放置顺序计数或索引?
我需要根据另一列中的值在列中写入序列/索引。 请在下面找到示例来解释我的请求: 在这里,我需要根据 color 列中的值在 customindex 列中生成索引值..所以基本上如果列中有 4 行带有红色,那么它应该将行索引为 1,2,3,4 然后当它2 行以蓝色为值,它应该再次从 1 -> 1,2 索引。
输入数据:
[
{
"Type": "Header","Color": "Red","Customindex": ""
},{
"Type": "Header","Color": "Blue",{
"Type": "LineItem","Color": "Yellow","Customindex": ""
}
]
这是我需要帮助的转换:
%dw 2.0
output application/json
var TM = flatten(payload map ((item,index) ->
[{
"Type":payload.type,//HEADER VALUES
"Color":"","Customindex":""
}]++
[{
"Type":payload.type,// LINE ITEM VALUES
"Color":payload.color,"Customindex":index // need the index sequence to only count similar colors.. For ex : red start with 1,3 then for blue again 1,2 and so on
}]))
---
(((TM distinctBy $ ... filters and groupings
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。