Versions Compared

Key

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

...

In this article

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

...

Snap type:

...

Transform 

...

Description:

...

Overview

You can use this Snap to convert binary data at the input view to

...

document data at the output view.

...

Snap Type

Binary to Document Snap is a TRANSFORM-type Snap that transforms binary data to document data.

Prerequisites

None.

Support for Ultra Pipelines

Works in Ultra Pipelines if Ignore empty string is not set.

Limitations

This Snap can receive multiple binary streams. If you select BYTE_ARRAY in the Encode or Decode drop-down list, then the maximum limit for each input binary stream is 2GB. This limit is much lower for other options and depends on the pattern of the input data.

Known Issues

None.

Prerequisites

None.

Support for Ultra Pipelines

Snap Views

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Binary 

  • Min: 1

  • Max: 1

  • File Reader

  • Multi File Reader

  • Hdfs Reader

  • CSV Formatter

  • JSON Formatter

Binary input document. Typically binary data as a value of the "content" key in the input document data.

...

Output

Document

 

  • Min: 1

  • Max: 1

  • Mapper

The output view provides the binary data as a byte array value to the "content" key in the output document data. If the input binary data contains header information, the meta data in the header will be present as a value to the key "original" in the output document data.

...

 For example, connect a Salesforce Create Snap as a downstream Snap to upload an attachment to an SObject record.

...

[None]

...

  • Works in Ultra Pipelines if Ignore empty string is not set.
  • This Snap can receive multiple binary streams. If you select Encode or Decode > BYTE ARRAY, then the maximum limit for each input binary stream is 2GB. The limit is much lower for other options and depends on the pattern of the input data.

...

Accounts are not used with this Snap.

...

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

...

Settings

Label

...

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 while 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 the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the 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

Info
  • Asterisk (*): Indicates a mandatory field.

  • Suggestion icon ((blue star)): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon ((blue star)): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon ((blue star) ): Indicates that you can add fields in the field set.

  • Remove icon ((blue star)): Indicates that you can remove fields from the field set.

Field Name

Field Type

Description

Label*

Default ValueBinary to Document
ExampleBinary_to_Document

String

Specify 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.

Encode or Decode

...

*

Default Value: ENCODE_BASE64
Example: BYTE_ARRAY 

Dropdown list

Select one of the following options to encode or decode the content. The options are:

  • ENCODE_BASE64: Allows you to encode the content.

  • DECODE_BASE64

...

  • : Allows you to decode the content.

Info

If the input "content" data has already been Base64-encoded and if you choose ENCODE_

...

BASE64, the Snap

...

does not encode the content again.

...

Similarly, if the input "content" data has not been Base64-encoded and if you choose DECODE_

...

BASE64, the Snap

...

does not attempt to decode the content.

...

 

  • DOCUMENT: Allows you to serialize the document into a SnapLogic-

...

  • specific JSON representation, which allows you to deserialize types such as Dates when read back using

...

  • a Binary To Document Snap.

  • BYTE_

...

  • ARRAY: Allows you to pass raw binary data.

...

  •  For example, a compressed .zip file can be created in many formats.  The safest way to convert such a file between binary and document is with BYTE_ARRAY.

...

  • NONE: Allows you to use the Snaplex's default platform specific encoding

...

  • .

...

  • You can

...

  • use this for string text such as a .xml or a .csv format.  Because this uses platform specific encoding, it can vary between Snaplexes; therefore

...

  • , we recommend that you not to use NONE when passing data between

...

  • Pipelines that may be running in Snaplexes which run different operating systems.

Info
  • This Snap can receive multiple binary streams. If you select BYTE_ARRAY in the Encode or Decode

...

  • dropdown list, then the maximum limit for each input binary stream is 2GB.

...

  • This limit is much lower for other options.

  • Depending on the input data, the encoded/decoded data can become larger than 2GB, even if the input data is smaller than 2GB.

...

Ignore empty stream

Default value

...

Ignore empty stream

...

: Deselected
Example: Selected

Checkbox

Select this checkbox to enable the Snap to ignore the incoming data stream when no document is received in the input view.

...

Deselect this checkbox to enable the Snap

...

to write empty binary data with a header

...

in the output view when no document

...

is received in the input view.

...

Snap Execution

Default

...

Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read

...

ValueValidate & Execute
Example: Disabled

Dropdown list

Select 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.

Example

Uploading a PDF File Attachment to a Salesforce Account Record

To upload a PDF file attachment to a Salesforce Account record,

...

build a

...

Pipeline using File Reader Snap

...

, Binary to Document Snap

...

, Mapper (Data) Snap

...

, Structure Snap

...

, and Salesforce Create Snap.

  • File Reader Snap: Enter a pdf file URL in the File property.

  • Binary to Document Snap: Select "ENCODE_BASE64" for the Encode or Decode property.

  • Mapper (Data) Snap: Enter one row of "$Id" in the Target path property and an ID of an existing Account SObject record.

  • Structure Snap:  Mapping table property

...

Source

...

Path

...

Operation

...

Target Path

 $original.content-location

 move

 $Name

 $Id

 move

 $Id

 $original.content-type 

 move

 $ContentType

 $content

 move

 $Body

  • Salesforce Create Snap: Enter "Attachment" in the Object type property.

The following pipeline reads the binary data from the upstream and converts it into document data in the output preview. 

...

The File Reader Snap reads the binary data to be converted:

...

Image Added

The output preview when ENCODE_BASE64 is selected:

...

Image Added

The output preview when

...

NONE is selected:

...

Image Added

The output preview when

...

DECODE_BASE64 is selected:

...

Image Added

The output preview when DOCUMENT is selected:

...

Image Added

The output preview when BYTE_ARRAY is selected:

...

Image Added

...

Snap Pack History

...