Forum Discussion

walkerline117's avatar
walkerline117
Contributor
7 years ago
Solved

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 documen...
  • tstack's avatar
    tstack
    7 years ago

    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.