Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Snap type:

Flow


Description:

This Snap routes binary documents to different output views based on a boolean expression.
 

A binary document consists of the binary content and a header that contains metadata for that content.  For example, a file containing JSON data might have a header with a 'content-type' field set to 'application/json'. This Snap then allows you to separate a single stream of binary documents into multiple streams based on their header data. For example, when unzipping an archive with the ZipFile Read Snap, any files with a "content-type" of "application/json" could be sent to a JSON Parser and "text/xml" files could be sent to an XML Parser. The set of header fields available depends on the Snap that outputs the binary document. You can click on the preview icon for a binary view to see the content and headers that are being generated for each binary document. The following fields are often available:
 

 Name Example Description
 content-type application/json The MIME type for the binary content.  If not available from the original source, this value will be derived from the file name.
 content-length 1234 The length of the binary content.
 content-location  sldb:///test.json The URL for the original source of the binary stream.
 last-modified 2014-07-17T17:12:03.000 UTC The date that the binary was last modified.


Note
Header fields are not yet available in the schema drop-down for the properties; consult the preview data to see what fields are available.


Prerequisites:

[None]


Support and limitations:Works in Ultra Task Pipelines.
Account: 

Accounts are not used with this Snap.


Views:


InputThis Snap has exactly one binary input view.
OutputThis Snap has at least two binary output view.
ErrorThis Snap has at most one document error view and produces zero or more documents in the view.


Settings

Label


Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Routes



Required. Expression to evaluate and output views to write a binary document if the expression evaluates to true. The Expression should be applied to the fields available in binary document header. List of expressions can be seen here.


Example:

  • $file_name == "File1"
  • $["content-length"] > 1000
  • $['content-location'].endsWith("File1")
  • startsWith($description, "Snap") && $quantity < 100

Default value: [None]
 

First match


If true (selected), then the first output view whose corresponding expression evaluates to true will only have the binary document written to it even if there are other matches. If false (not selected), then all output views whose corresponding expression evaluates to true will have the binary document written to it.
 
Example

Expression | Output View Name
$["content-length"] > 1000 | output1
$["content-length"] <=1000 | output2

 
Default value: Not selected


Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read


Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read

Examples


Pipeline Demonstrating the Binary Router Snap

This pipeline demonstrates the Binary Router Snap. 


 


The first Snap reads a JSON document that contains three filenames. The JSON Splitter Snap turns it into three documents and the filename is passed as a parameter to the File Reader Snap. That Snap reads the first file, passes it to the Binary Router Snap where it is evaluated, a new file is written and then the next file is read and the process is repeated.

The evaluation in the Binary Router looks at the content-length and sends it to a different output view depending on size based on the following criteria:

  • $["content-length"] <= 10

  • $["content-length"] >= 11 && $["content-length"] <= 1023

  • $["content-length"] > 1024 

Downloads

Attachments
patterns*.slp, *.zip

Downloads

Attachments
uploadfalse
oldfalse
patterns*.slp, *.zip

Insert excerpt
Flow Snap Pack
Flow Snap Pack
nopaneltrue