1
votes

In dataweave2.0 if payload is empty it should print only headers with pipe seperated. i have tried below code:

%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
The problem is your example is giving empty values for the fields so there is an empty line to outputRyan Carter

1 Answers

0
votes

%dw 2.0

output application/csv separator='|', header=false

[{ field1: "field1", field2: "field2"

}]

Try this it may works for you...