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

...

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Binary

  • Min: 1

  • Max: 2

  • Read CSV Data

  • Read CSV HeaderFile Reader

This Snap has at most two binary input views, where it gets the CSV binary data to be parsed.

If there are two input views, it gets the CSV binary data to be parsed from the first input view and the CSV metadata from the second input view. The metadata should be a CSV format with two lines of CSV data: the first line is the CSV header, the second, data types. Supported data types are 'string', 'integer', 'float' and 'boolean'. If 'string' is a default data type, empty data type fields are considered to be 'string' type. An example of CSV metadata is:

Last name,First name,age,commute_km,isDriving

string, ,integer,float,boolean

Output

Document

  • Min: 1

  • Max: 1

This Snap has exactly one document output view, where it provides the CSV document data stream.

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.

...

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

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

Settings

Required.
Format:

Skip lines

Required. The Skip lines property specifies the number of lines in the input data to be skipped Value  Validate & Execute

Field Name

Field Type

Description

Label*

Default ValueCSV Parser
ExampleCSV_Parser

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.

Quote character

Default Value: “
Example:

Character

Specify the character to be used for a quote. As of 4.3.2, this property can be an expression, which is evaluated with the values from the Pipeline parameters.

Info

Only a single character is allowed as a quote character.

Delimiter*

Default value:
Example: \t, \u001 

Character or Unicode

Specify the character to be used as a delimiter in parsing the CSV data. In case if you want to use tab as a delimiter, enter "\t" instead of pressing the Tab key. Any Unicode character is also supported.  As of 4.3.2, this property can be an expression, which is evaluated with the values from the pipeline parameters.

Escape character

Default value: \
Example: \

Character

Specify the escape character that is to be used when parsing rows. Only single characters are supported. As of 4.3.2, this property can be an expression, which is evaluated with the values from the pipeline parameters. Leave this property empty if no escape character is used in the input CSV data.
Snap Execution

Skip lines*

Default

value:

0
Example:

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.

Troubleshooting

5

Integer

Specify the number of lines that are to be skipped in the input data before the Snap starts parsing it.

 

note
Info

Skip lines support works well if

it

the number specified is less than or equal to the number of lines of the first partition. If it is larger than the number of lines of the first partition, only the first partition will be skipped.

Example: 0 

Contains header

Default value:

Selected

Format

Example:

Integer The Contains header property specifies whether

Deselected

Contains header

Checkbox

Select the checkbox to specify if the input data contains the CSV header or not.

 

Example: True 
Default value: True 
Format: Boolean 

Column names 

The Column names property

Use this fieldset to specify the column header names, which is a composite table

property, which contains the Columns

property

in it

.

Info

This property is ignored if the second input view is used for the CSV metadata.

Note

You must either select Contains header or specify a Column name in order for validation on the pipeline to work.

Header

Specifies

String

Specify the list of headers that are to be used as a CSV header in

formatting when

case you deselect the Contains header property

is deselected


Example

  • Last Name 

  • First Name 

  • Street 

  • City 

  • State 

Validate headers

Default value

: [None] 

Validate headers

This option specifies whether or not

: Deselected
Example: Selected

Checkbox

Select the checkbox to specify if the headers from the input data should be validated against the Column names table property or not. If this option is

checked

selected, the Snap throws an exception when they do not match exactly.

Header size error policy

Default value

: [None]

Header size error policy

Defines

: Both
Example: Trim record to fit header

Dropdown list

Select an option to define how to handle errors for records that do not match the header columns in the CSV file. This error condition occurs if the input document has fewer or additional columns that do not match with the header columns. The available options are:

  • Trim record to fit header: The Snap trims the records to match the header columns and sends them to the output view if the values in the CSV file are more than the header columns. If the values are less than the header columns, the Snap sends the values as-is to the output view with blank spaces.

  • Fail if record is larger than header: The Snap sends the document to the output view if the values in the CSV file match with the header columns. Else, the Snap writes the output to the error view when the values in the CSV file are either more or less than the header columns. 

  • Both: The Snap sends the trimmed records to the output view and also sends those records to the error view whose values are either more or less than the header columns.

Character set

Default value:

Both

Auto BOM detect.
Example:

Trim record to fit header

Character set

This setting lets you select

UTF-8

Dropdown list

Select an option to specify the character set in which input CSV data is encoded. The

supported selections

available options are:

  • Auto BOM detect: The Snap attempts to detect BOM (Byte Order Mark) in the input CSV data. If no BOM is found, UTF-8 character set is used by default.

  • UTF-8

  • UTF-16LE

  • UTF-16BE

  • ISO-LATIN-1:  This character set is also called ISO-8859-1 and generally intended for Western European languages.

Ignore empty data

Default value:

Auto BOM detect.

Ignore empty data

This property can be set false to produce

Selected
Example: Deselected

Checkbox

Select this checkbox to send the document to error view if the input is empty.

If you do not select this checkbox, then it produces an empty output document when the input CSV data is empty (both an empty binary stream and a binary stream with CSV headers only). This feature may be useful if the downstream Snaps should be executed whether the input CSV data is empty or not.

Preserve Surrounding Spaces

Default value: Deselected
Example:

True

Selected

Preserve Surrounding Spaces

Checkbox

Select this checkbox to preserve the surrounding

spaces for name

spaces for the values that are non-quoted. 

  • If you enable the expression icon when the checkbox is selected, then the value of this setting is set to true.

  • If you enable the expression icon when the checkbox is not selected, then the value of this setting is set to false.

Note

This setting is applicable only for unquoted data.

For example, if you are using data with a delimiter as follows:

NAME|AGE|GENDER
AA| 12| F
BB| 23| M
If you deselect this checkbox, then surrounding spaces are removed before 12, 23, F, and M.

Multiexcerpt include macro

Snap Execution

pageAnaplan Read

Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read

Note

You must either select Contains header or specify a Column name in order for validation on the pipeline to work.

Examples

Use Case

Default ValueValidate & Execute
Example: Execute only

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.

Examples

Pipeline: Split a CSV File

Using the CSV Parser Snap Schema Capability

...

For example, if you have input data in the CSV file as follows, with no header line:

...

You Then, you can create a definition of the CSV data in another CSV file as follows:

...

Note the data types are optional, and defined on the second line of the input file.  The parser supports the use of 'string', 'integer', 'float' and 'boolean' types. String is the default data type, any empty data type fields are considered to be strings.

...

where the Read Snaps are File Readers.

The CSV Parser is configured as follows:

...

Image Modified

...

Views is configured as follows:

Image Modified

...

The resulting data in the SnapLogic pipeline data flow looks like this:

...

Image Added

...

Snap Pack History

...

...