Create Filenames Using the CSV Formatter Snap

This example demonstrates how to use CSV Formatter Snap to (documents that contain purchase-related details and, depending on the value of the purchases) to route them into two documents, picking up their names using the output of the CSV Formatter Snap.


Example Pipeline

Download this pipeline

For the purpose of this example, we are picking up CSV data from a CSV Generator Snap. You can also supply this data using a combination of File Reader and CSV Parser Snaps.

The CSV Generator Snap contains transaction details, as shown below:

We copy the output of the CSV Generator Snap and connect each copy to a Filter Snap, where we filter out transactions based on whether they are worth more or less than $40:



We now add a 'Bill_Type' binary header property to each set of filtered outputs, so each document is tagged appropriately:

We now have two records, one containing all transactions worth less than or equal to $40 and another containing all transactions over $40. We now write each of these files to the SLDB using the File Writer Snap, configuring it to include this classification of transactions in the filename. We do this using the $Bill_Type+".csv" expression in the File name property.

You can now see that two new files were created in the project: $Small.csv and $Large.csv:

Downloads

Note: To successfully reuse pipelines:
  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide Pipeline parameters as applicable.