Using DataWeave to combine CSV payloads
<p>I have a Mule application that needs to produce some CSV output which looks like the following:</p>

<pre><code>[CSV Payload 1]
Data|Data|Data
[CSV Payload 2]
Data|Data|Data|Data|Data|Data|Data|Data|Data
[CSV Payload 3]
Data|Data|Data|Data
[CSV Payload 4]
Data|Data|Data|Data|Data|Data
</code></pre>

<p>As you can see, I have a combination of 4 CSV payloads, each with different structures. The first two of these payloads are single line and hard coded. The third is derived from an input file and the fourth is an extract from a database.</p>

<p>My question is: is DataWeave suitable for achieving this or should an alternative method (such as scatter gather) be explored? I've tried to implement this in DataWeave with no luck as I'm struggling to get past the limitation of having to define an output structure.</p>

<p>Please note: the order of the final output needs to be Payload 1 then 2 then 3 then 4. This order cannot be mixed up.</p>