Mule 4 DataWeave 将数组传递给 Db::createStruct
这是我的有效负载:
[
[
2452,
1,
"AA",
"SH289122275",
"82310",
"CB",
"83.5"
],
[
3456,
2,
"BB ",
"SH389122275",
"92310",
"BB",
"83.5"
]
]
如何动态地将我的有效负载适应下面的转换(即[111,“aaa”],[222,“bbb”]),我可能会在我的有效负载中获得更多对象。
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",[
Db::createStruct("Database_Config","DEMO_OBJECT",[111,"aaa"]),
Db::createStruct("Database_Config","DEMO_OBJECT",[222,"bbb"])
])
}
This is my payload:
[
[
2452,
1,
"AA",
"SH289122275",
"82310",
"CB",
"83.5"
],
[
3456,
2,
"BB ",
"SH389122275",
"92310",
"BB",
"83.5"
]
]
How to fit my payload into below transformation dynamically (i.e at. [111,"aaa"],[222,"bbb"]), I may get more objects in my payload.
%dw 2.0
output application/java
---
{
attribute: Db::createArray("Database_Config","DEMO_OBJECTS",[
Db::createStruct("Database_Config","DEMO_OBJECT",[111,"aaa"]),
Db::createStruct("Database_Config","DEMO_OBJECT",[222,"bbb"])
])
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取决于输入中数据的结构和顺序。这是一个可能的示例,您可以根据自己的具体需求进行调整:
Depends on the structure and order of the data in the input. This is a possible example that you can adapt to your specific needs: