【发布时间】:2015-11-26 23:53:06
【问题描述】:
我对 dataWeave 的输入:
集合(即“订单”对象列表)
1st Order Object
----SampleObject1 (SampleObject is also a List of Objects that is getting repeated)
--- SampleValue1 (some 'String' attribute of 'Order' object)
--- SampleValue2
---SampleObject2
--- SampleValue3 (some 'String' attribute of 'Order' object)
--- SampleValue4 .
------SampleObject3
--- SampleValue5 .
--- SampleValue6
------SampleObject4
--- SampleValue7
--- SampleValue8
.
2nd Order Object
----SampleObject1 (SampleObject is also a List of Objects that is getting repeated)
--- SampleValue1 (some 'String' attribute of 'Order' object)
--- SampleValue2
---SampleObject2
--- SampleValue3 (some 'String' attribute of 'Order' object)
--- SampleValue4 .
------SampleObject3
--- SampleValue5 .
--- SampleValue6
------SampleObject4
--- SampleValue7
--- SampleValue8
对于集合中的每个“订单”对象,我需要一个 CSV 记录。
输出CSV:
SampleValue1 SampleValue3 SampleValue5 ..... (For 1st'Order' object)
SampleValue1 SampleValue3 SampleValue5 .... (For 2st'Order' object)
SampleValue1 SampleValue3 SampleValue5 ..... (For 3rd'Order' object)
.
.
.
.
我需要以下输出。我在 DataWeave 组件中尝试了多种组合。但无法解决。我面临的问题是,我需要每个对象的 CSV 记录。但我得到的是每个“SampleValue”的记录。请帮助我如何克服这个问题。提前致谢!!
【问题讨论】:
-
所以你的 CSV 是 TAB 分隔的文件,对吗?
-
@Naveen Raj。是的,纳文。问题在于没有分隔符。它与映射。对于每个样本值,我在 CSV 中得到一行。但我需要的是每个对象“订单”的行。根据某些条件检查,每个订单对象也只有 3 个样本值,也就是说每个订单对象大约有 24 个样本值
-
如果您需要对要求进行任何说明,请发表评论。我需要解决这个问题
-
如果您需要任何问题,请告诉我
-
@NaveenRaj 感谢您的回复。我知道需要某种 Java 代码。会尝试,如果有任何疑问,肯定会回复您。谢谢
标签: csv mule mule-studio dataweave