Compose the pipeline

Pipelines are composed of individual Snaps. Each Snap performs a discrete piece of work. Data flows as input to a Snap, the Snap processes it and outputs the results to the next Snap.

To split the data from a CSV file into two files, this example uses the following Snaps:

To compose the pipeline:

  1. Click Designer to open the design canvas.
    • If you didn't have a pipeline open, the canvas opens with a new empty pipeline:

    • If an existing pipeline opens, click Add to create a new pipeline.

    The appearance of the left side of the screen depends on your profile settings. The screenshot above shows the Asset Palette, an opt-in feature under Designer Settings. The remaining steps assume use of the Asset Palette.

  2. Add and configure a File Reader Snap:
    1. In the Asset Palette click Snaps.
    2. In the Search box, start entering File and drag the File Reader Snap from the results list to the canvas.
    3. Click the Snap to open it.
    4. In the Settings tab, click the database icon on the right side of the File field
    5. From the Project menu, select shared.
    6. In the filterfield, enter directory and click the file when it displays. The path to the file includes the environment name and the shared folder.
    7. Save and close the Snap.
  3. If the IRIS Integration Assistant is enabled in your profile, you'll see a suggestion of the CSV Parser Snap as shown below. Click it to accept the suggestion. If you aren't using IRIS, search for the CSV Parser Snap and connect it to the right of the File Reader Snap.
    IRIS Snap suggestion

    The CSV Parser Snap takes the file input by the File Reader Snap and outputs a document in JSON format. Our example requires no further configuration.
  4. Use a Filter Snap to remove all members of the Operations department from the results:
    1. Search for the Filter Snap and select it from the the Flow category. Drag it to the right of the CSV Parser Snap.
    2. Click to open the Snap settings.
    3. From the dropdown menu on the Filter Expression field, select the Input schema Department field.
    4. Enter !="Operations". The expression icon on the left with a dark background shows that this is an expression. The green checkmark in the following screenshot shows that it's valid. If you don't see a green checkmark, delete the expression and try again.
      Filter Snap example

    5. Save and close the Filter Snap. The pipeline should look like this:
      After the Filter Snap

  5. It's good practice to save and validate your pipeline after adding a few Snaps. How you do this depends on whether validation and data preview is enabled in the environment. Assuming that it is, on the pipeline toolbar, click Save. Designer validates the Snaps, which turn green. Click the document icon on the right side of the Filter Snap to preview the output. Note that the records no longer include employees from Operations.
  6. Configure a Router Snap to send employee records to different files based on their location. Records in the CSV file have three values for location, HQ, CO, and Field. To separate the employees in the field from those at headquarters or in the Colorado office:
    1. Search for Router and select the Router Snap from the Flow category.
    2. Click the Snap to open its settings. The Routes section includes two fields, one for each output view
    3. Open the dropdown menu for the first expression and select Location from the Input Schema.
      Tip: For clarity, you can rename the views in the Views tab.
    4. Enter =="Field". This routes records for employees in the field to the output0 view.
    5. For the second expression, select Location again and enter !="Field". This routes employees in the other locations to the output1 view.
      Tip: As you enter the expression, a preview pops up to show which records match.
    6. Save and close the Snap.
  7. Transform the output from the Router Snap into CSV format:
    1. Search for CSV Formatter and drag two of them onto the canvas, connect one to output0 and one to output1.
    2. Leave them with their default configuration.
  8. Configure File Writer Snaps to write the data to two files:
    1. Search for File Writer, drag one and connect it to one of the CSV Formatter Snaps.
    2. Drag a second File Writer Snap to the other CSV Formatter Snap.
    3. Click the top File Writer Snap to open its settings.
    4. In the File Name field, enter Field-personnel.csv.
    5. Save and close the Snap.
    6. Open the bottom File Writer Snap and enter HQ-CO-personnel.csv as the file name.
    7. Save and close the Snap.
  9. Save and run the pipeline. As each Snap executes, it turns green:

Because we didn't specify a different location, the pipeline writes the files to your default project. You can find the project name by clicking the Edit Pipeline Properties button in the Designer toolbar. To view the output files:

  1. Click the Manager tab to open Manager.
  2. In the left navigation pane, select your project.
  3. In the main pane, click Files to view your files.

Congratulations, you've completed a transformational pipeline!