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

...

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

Prerequisites

...

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Document

  • Min: 1

  • Max: 1

  • Structure

  • Copy

This Snap has at the max one input view which is a document data with a "content" key/value pair, the . The value of the "content" key should be a byte array or a string or a character array.

Output

Binary

  • Min: 1

  • Max: 1

  • HDFS Writer

  • File Writer

The output view provides the binary data copied from the value to the "content" key in the input document data. If the input document data contains fields other than the "content" key/value pair, the input data (other than the "content") is inserted into the header part of the output binary data. One use case would be to connect Salesforce Attachment Download Snap as an upstream Snap to download a file attached to an SObject record.

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:

  • Stop Pipeline Execution: Stops the current pipeline execution if the Snap encounters an error.

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

...

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

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

Encode or Decode

Required. 

Number of records

Default Value
Example:

Specify advanced parameters that you want to include in the request.

Field Name

Field TypeField Dependency

Description

Label*

Default ValueELT Database Account Document to Binary
ExampleELT RS AccountDocument_to_Binary

String

None.

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.

String/Expression

Sampling Type is Number of records.

Enter the number of records to output.

Field set Name

Field 1*

Default Value<value> or None.
Example<value>

String

Debug mode check box is not selected.

Field 2

Default Value<value> or None.
Example<value>

String

None.

Snap Execution

Default Value
Example: Validate & Execute

Dropdown list

N/A

Select one of the following three modes in which the Snap executes:

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

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.

Encode or Decode

Example: BYTE_ARRAY
Default valueENCODE_BASE64 

Dropdown list

Select if the content should be Base64 encoded or Base64 decoded or none (BYTE_ARRAY). The options are:

  • ENCODE_BASE64

  • DECODE_BASE64

  • DOCUMENT

  • NONE

  • BYTE_ARRAY

If the input "content" data has already been Base64-encoded and ENCODE_BASE64 is selected, the Snap will not encode the content again. In the same way, if the input "content" data has not been Base64-encoded and DECODE_BASE64 is selected, the Snap will not attempt to decode the content. The format option DOCUMENT allows you to serialize the document into a SnapLogic-specific JSON represenation, which allows you to deserialize types such as Dates when read back using a BinaryToDocument Snap.

BYTE_ARRAY is used 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.

When NONE is selected, the Snaplex's default platform specific encoding is used.This can be used for string text such as a .xml or a .csv format.  Because this uses platform specific encoding, it can vary between Snaplexes; therefore it is not advised to use NONE when passing data between pipelines that may be running in Snaplexes which run different operating systems.

Example: BYTE_ARRAY

Default value:    ENCODE_BASE64 

Binary header properties

Specifies the properties to add to the binary document's header. Click + to add a binary header

Use this fieldset to specify the properties.

Info
  • You can access the properties in a binary document header in the expression properties of downstream Snaps. For example, a 'content-location' property added to the header in this Snap can be referenced in the File name property of a File Writer Snap with the expression: $['content-location']. 

  • If you configure the Snap to output a single binary document, the headers are computed from the first input document. 

Example: Status can be specified using the Snap Header properties. 

Expression

Default value:

None 

None

String/Expression

The Enter the target JSON path where the value from the expression will be written.

Specify the value to use for a property in the binary header.

Target Path

Default value: None

Target Path


Example: $['content-location'] to write the property 'content-location'.

Default value: None

Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read

Multiexcerpt include macronameSnap_Execution_IntroducedpageAnaplan Read

String

Enter the target JSON path where the value from the expression will be written.

Snap Execution

Default ValueValidate & Execute
Example: Execute only

Dropdown list

Select one of the following three modes in which the Snap executes:

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

Examples

Downloading a PDF File Attached to a Salesforce Account Record

...

The following pipeline reads the data in a .json format, encodes the data into a binary format and then decodes the data into output view.

...

The File Reader Snap reads the JSON data to be encoded to a binary format:

The Binary to Document encodes the data from the input stream, the respective output preview as displayed below:

The Document to Binary Snap decodes the data into an output preview as displayed below:

...

...

Snap Pack

...

History