将数组分配给mule中的String

时间:2015-09-29 13:08:05

标签: mule mule-studio dataweave

如何将数组分配给String?我想将XML转换为CSV。我的dataweave返回数组。我想将其转换为CSV格式。

转换消息代码:

%input payload application/xml
%output application/java
---
(payload.catalog.*category-assignment default []) groupBy $.@product-id pluck {

        product-id:$$,
        cat-id: $.@category-id joinBy ":",
        primary-flag:$.primary-flag,
        field3:$.@category-id when $.primary-flag[0] == "true"  otherwise ""

    }

我的有效负载如下:

[{
    product - id = D198561, cat - id = 1111, primary - flag = null, field3 =
}, {
    product - id = D198563, cat - id = 30033, primary - flag = [true], field3 = [30033]
}, {
    product - id = D198566, cat - id = 0933: 2104: 7043, primary - flag = null, field3 =
}]

我希望CSV中的输出相对于有效负载为:

Field1: product-id, Field2:cat-id,Field3:field3

它在字段3中给出错误,因为它是像field3 = [30033]这样的数组 提前致谢

0 个答案:

没有答案