In this article
...
Snap Type
Mapper Snap is a TRANSFORMTransform-type Snap that transforms data and passes it to the downstream Snap.
...
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input |
|
| Binary-to-Document | This Snap can have a most one document or binary input view. If you do not specify an input view, the Snap generates a downstream flow of one row. By default, this Snap has Document as Input Type. You can select Binary type if your input is in Binary format. |
Output |
|
| Any Document Snap | This Snap has exactly one document or binary output view. By default, this Snap has Document as Output Type. You can select Binary type to view the output in Binary format. |
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 when running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:
Learn more about Error handling in Pipelines. |
...
Field Name | Field Type | Description | ||||
---|---|---|---|---|---|---|
Label* Default Value: Mapper | String | 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. | ||||
Null-safe access Default Value: Deselected | Checkbox | Select this checkbox to set the target value to null in case the source path does not exist. For example, | ||||
Pass through Default Value:Deselected | Checkbox | This setting determines if data should be passed through or not. If you select this checkbox, then all the original input data is passed into the output document together with the data transformation results. If you deselect this checkbox, then only the data transformation results that are defined in the mapping section appear in the output document and the input data is discarded.
When to always select Pass through Always select Pass through if you plan to leave the Target path field blank; else, the Snap displays an error that the field that you want to delete does not exist. This is the expected behavior. For example, you have an input file that contains a number of attributes; but you need only two of these downstream. So, you connect a Mapper to the downstream Snap supplying the input file, select the two attributes you need by listing them in the Expression fields, leave the Target path field blank, and select Pass through. When you execute the Pipeline, this Snap evaluates the input documents/binary data and picks up the two attributes that you want, and passes the entire document/binary data through to the Target schema. From the list of available attributes in the Target Schema, the Mapper Snap picks up the two attributes you listed in the Expression fields, and passes them as output. However, if you had not selected the Pass through checkbox, the Target Schema would be empty, and the Mapper would display a | ||||
Transformations* | Use this field set to configure the settings for data transformations. | |||||
Mapping Root Default Value: $ | String/Suggestion | Specify the sub-section of the input data to be mapped. Learn More: Understanding the Mapping Root. | ||||
Input Schema | Dropdown list | Select the input data (that comes from the upstream Snap) that you want to transform. Drag the item you want to map and place it under the Mapping table. | ||||
Mapping table | Use this field set to specify the source path, expression, and target path columns used to map schema structure. | |||||
Expression Default Value: N/A | String/Expression | The function to use to transform the data. For example, combine, concatenate or flatten. Expressions that are evaluated replace the source targets at the end of the Pipeline runtime.
Lear More: Understanding Expressions in SnapLogic and Using Expressions for usage guidelines.
| ||||
Target path Default Value: N/A | String/Suggestion | The target JSON path where the value from the evaluated expression is written. For example, after evaluation of the Target Path Recommendation
For example, you have the Expression $Emp.Emp_Personal.FirstName in one of your Pipelines. And you have set the Target path for this expression as $FirstName. Now, if you use the expression $Emp.Emp_Personal.FirstName in a new Pipeline, then Iris suggests $FirstName as one of the recommended Target paths. This helps you standardize the naming standards within your org. The following video illustrates how Iris recommends Target path in a Mapper Snap: | ||||
Snap Execution | Dropdown list | Select one of the three modes in which the Snap executes. Available options are:
|
...
Learn More: Using the Mapping Table.
Input and Output Preview
The Input Schema of the Mapper Snap displays the input strings from the upstream Snap. On validation, the Input Preview displays the preview of the input from the upstream Snap, and the Output Preview displays the preview of the output to be passed to the downstream Snap. The following elements are available in the Input and Output Previews.
...
Callout Number | Elements | Description |
---|---|---|
1 | Expand All | Expands the objects in the Input/Output. |
2 | Collapse All | Collapses the objects in the Input/Output. |
3 | Collapse Level | Collapses the level of objects from 0-2 or All. |
4 | Render whitespace | When you select this checkbox, the blank spaces (leading, trailing, or in the middle of a string) in an expression field are rendered as symbols in the output.
When you deselect this checkbox, the Snap renders blank spaces and tabs as-is. By default, the Render whitespace checkbox is selected. |
5 | Download | Downloads the JSON file. |
Examples
Removing Columns from Excel Files Using Mapper
...
If the Escape Character is | Use Expression | Sample Output | ||
---|---|---|---|---|
Single quote (') | JSON: $original.mapValues((value,key)=> value.toString().replaceAll("'","''")) OR $original.mapValues((value,key)=> value.toString().replaceAll("'","\''")) CSV: $[' Business-Name'].replace ("'","''") | |||
Ampersand (&) | JSON: $original.mapValues((value,key)=> value.toString().replaceAll("'","\&'")) OR $original.mapValues((value,key)=> value.toString().replaceAll("'","&'")) CSV: $[' Business-Name'].replace ("'","&'") | |||
Backslash (\) | JSON: $original.mapValues((value,key)=> value.toString().replaceAll("'","\\'"))
CSV: $[' Business-Name'].replace ("'","\\'") |
In this way, you can customize the data to be passed on to downstream Snaps using the Expression field in the Mapper Snap.
...
Community Links:
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|