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

Overview

This is a Transform type Snap that is used to detect and convert the data type of the incoming documents. It has the ability to automatically derive the type of each value. You can also specify your preference for handling certain fields in the input document. 

Input and Output

Expected input: A document input. Data types in the sub-levels in a nested JSON may not be detected.

Expected output: A document output where the data types have been converted based on the Snap's settings.

Expected upstream Snaps: Any Snap that provides a document stream output. For example, Mapper, or a combination of File Reader and JSON Parser.

Expected downstream Snaps: Any Snap that accepts a document input. For example, Profile, Mapper, or a combination of JSON Formatter and File Writer.

Prerequisites

None

Configuring Accounts

Accounts are not used with this Snap.

Configuring Views

Input

This Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
ErrorThis Snap has at most one document error view.

Troubleshooting

None

Limitations and Known Issues

None

Modes


Snap Settings


LabelRequired. The name for the Snap. Modify this to be more specific, especially if there are more than one of the same Snap in the pipeline.
Auto

Required. If selected, the Snap detects the data types automatically. 

Default value: Selected

Policy

Specify your preferences about data types of fields if the auto-mode does not work as expected.

Field

The field that the type has to be converted. This is a suggestible property and suggests all fields in the dataset.

Default value: None

Type

The type of transformation to be performed on the selected column. Four options are available: 

  • Integer
  • Decimal
  • String
  • Date Time

Default value: String

Format

Only applicable for date time type, specify the format. See Simple Date Format for details and Date Functions and Properties for expression examples. 

Default value: None

Example: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'

Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read


Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read



Example


Automatic Type Conversion

In this example, the input dataset's data types are automatically converted to their correct data types based on their value.

Download this pipeline.

Expand
titleUnderstanding the pipeline

The input is a CSV document generated by the CSV Generator Snap. This document contains fields of various data types. Below is a preview of this document:

The Copy Snap is used to create two streams of this document. One stream goes into the Type Converter Snap and the other goes into the Type Inspector Snap. The Type Inspector is not necessarily required in this case but it is used to identify the fields in the document that have the wrong data type. Below is a preview of the output from the Type Inspector Snap:

The field $Deadline has the wrong data type. To correct this the Type Converter Snap is to be used.

Generally, the $ID field is supposed to be integer data type, but in this case since it is a categorical field it should be string data type. This is why the Type Converter Snap is configured to let the $ID field remain a string. The data type of the fields not listed in the Policy properties is automatically converted based on its value.

The Type Converter Snap is configured as shown below:

Based on its configuration, the Snap detects and converts data types. Below is a preview of the output from the Type Converter Snap:

A Type Inspector Snap is used downstream to demonstrate that the data type has indeed been converted by the Type Converter Snap. Below is a preview of the output from the Type Inspector Snap:


Download this pipeline.



Downloads

Attachments
patterns*.slp, *.zip

Excerpt Include
ML Data Preparation Snap Pack
ML Data Preparation Snap Pack
nopaneltrue