Does the CSV formatter snap aggregate the input documents
Hi.
If we have 5 input documents for a CSV formatter snap, how many output documents I will get from the CSV formatter?
My observation now is that CSV formatter snap will group all input documents into one and output only one big CSV file.
Is there a way to change the behavior of this? In my example, if I have 5 input documents, how to config so CSV formatter snap can output 5 output documents/files?
Thanks
Since the CSV Formatter currently doesn’t work with arrays, you will need to use a child pipeline that splits the array into separate docs that go into a CSV Formatter.
I’m attaching a couple of pipelines to demonstrate this flow:
FormatArrayToCSV_2019_02_28.slp (5.6 KB)
WriteCSVFiles_2019_02_28.slp (5.4 KB)The FormatArrayToCSV pipeline is the child. It splits the “$array” property in the incoming document and then passes the results to a CSV Formatter and FileWriter. You’ll need to change the JSON Splitter to split your array property.
The WriteCSVFiles pipeline is the parent. It just contains some mock data and feeds it into the child pipeline.