Forum Discussion
tstack
9 years agoFormer Employee
Getting back to your original question, you can write separate documents with the JSON-Formatter, XML-Formatter, and DocumentToBinary snaps. You can then configure the FileWriter snap with an expression for the file name, for example:
'out_' + Date.now() + '.json'
Or, if you just want a sequence number, you can use the ‘snap.in.totalCount’ variable:
'out_' + snap.in.totalCount + '.json'
So, every document generated by the formatter snap will be written to its own file with the name computed by the expression.
To configure the formatters:
- JSON Formatter - Select the ‘Format each document’ option.
- XML Formatter - Clear the ‘Root element’ field. Note that the input document should only have a single field that represents the root element.
- Document To Binary - Set ‘Encode or Decode’ to DOCUMENT.