mule4 dataweave 2.0仅使用标头写入csv文件

时间:2019-04-02 13:42:54

标签: java mule mule4

在dataweave2.0中,如果有效载荷为空,则应仅打印分隔管道的标头。我试过下面的代码:

%dw 2.0
output application/csv separator='|', header=true
---
[{
      field1: "",
      field1: ""

}]

Output:
field1|field2|field3
|||

Desired output is only headers:
field1|field2|field3

Please guide

1 个答案:

答案 0 :(得分:0)

%dw 2.0

输出应用程序/ csv分隔符=“ |”,标头= false

[{       field1:“ field1”,       field2:“ field2”

}]

尝试一下,它可能对您有用...