Router

Overview

This Snap routes documents to output views matching a boolean expression. If no expressions are specified, documents will be evenly distributed across all output views. Multiple views are added to the router through the Views tab. When entering in an output view name and clicking Apply Changes, output view links will be attached to the router in order they are declared.

Router vs. Filter

The Router and Filter Snaps are similar, but the Filter Snap only handles a single stream. The Router Snap is designed to handle multiple output views.

Expression functions can be found at Understanding Expressions in SnapLogic.



Snap views

View Description Examples of upstream and downstream Snaps
Input This Snap has exactly one document input view.
Output This Snap has at least two document output views.
Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Legend:
  • Expression icon (): Allows using pipeline parameters to set field values dynamically (if enabled). SnapLogic Expressions are not supported. If disabled, you can provide a static value.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field / Field set Type Description
Label String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: Router

Example: Router
Routes

Expression to evaluate and output views to write a document if the expression evaluates to true. The list of expressions can be seen in Understanding Expressions in SnapLogic

When there are no routes defined, this Snap will be in auto-routing mode. In this mode, this Snap works like a load balancer; incoming documents will be forked evenly across all output views, in an alphabetically-ordered, round-robin fashion.

Note: If ANY route contains an expression, then only those with expressions are evaluated; those routes without an expression will evaluate to false.

Default value: None.

Example:
  • $first_name=="Joe"
  • $people[0].age > 15
  • startsWith($descriptions, "Snap") && $quantity < 100
First Match Checkbox If true, then the first output view whose corresponding expression evaluates to true will only have the document written to it even if there are other matches. If false, then all output views whose corresponding expression evaluates to true will have the document written to it.

Default status: Deselected

Snap execution Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Execute only

Example: Validate and Execute

Example: