Mapping Table

Overview

The Mapping table in the Mapper Snap enables you to do the following:

  • Determine which fields in a schema are mapped or unmapped.
  • Create and manage a large mapping table through drag-and-drop.
  • Search for specific fields.
Note: When you use the Mapper, ensure the following:
  • If an XML schema is exposed in the Target schema column of the Mapper Snap, map the attribute fields before the element fields of the enclosing element field. The mapping ensures that the JSON data from the Mapper Snap is valid for converting to XML.
  • If a Copy Snap is placed directly after a Mapper Snap, schema information is not visible in the target schema of the Mapping Table.

mapping-table

Table 1.
Callout number Element Description
1 Input Schema The input schema lists all the schema elements from the upstream Snap. You can drag the desired schema element to the Mapping table. Learn more.
2 Search The inline Search in the Mapping table helps you to quickly find specific mappings. Learn more.
3 Target Schema The schema generated by a downstream Snap populates a list of suggestions for the Expression column. This functionality is useful when the Mapper Snap is followed by Snaps with custom fields, such as the JSON Formatter or NetSuite Snaps. Learn more.
4 Input Preview Displays the input preview of the specified mappings in the mapping table.
5 Arrow Click the arrow below the mapping table to preview the input and target schemas.
Note:
  • The Expression Builder preview is driven by the Dynamic Validation option in Global user settings and Designer settings.
  • Non-expression targets (= toggle off) are treated as literal values and do not impact the mapped/unmapped field list.
6 Output Preview Displays the output preview of the specified mappings in the mapping table.

Input schema

You can use any of the following features to select multiple fields in an Input or Target schema:

  • Select All: Click this button to select all fields in a schema, including the collapsed children.

  • Deselect All: Click this button to deselect all the selected fields in a schema, including the collapsed children.

    1. To select (or deselect) a subset of the schema, search for the key name.

    2. Click Select All or Deselect All.

    Note: Select (or deselect) applies only to fields that match the search terms.
  • Shift-click: You can also use a keyboard shortcut to select a range of fields. Select the first field in the range, hold down the Shift key, then select the last field in the range. You can also hold down the Shift key and click a plus symbol + in the schema hierarchy to expand that part of the hierarchy.


    Input Schema

View mapped and unmapped fields
Use the dropdown next to the search field to filter the fields based on All, Mapped, or Unmapped fields:
Input Schema - 2

When a field is mapped, it is bolded and highlighted when you select All:
String input

When you drag the data from the input schema into the mapping table, you can use JSON Path expressions to transform the data.
Transformations

Target schema

The schema generated by a downstream Snap populates a list of suggestions for the Expression column. This functionality is useful when the Mapper Snap is followed by Snaps with custom fields, such as the JSON Formatter or NetSuite Snaps.

For example, the following schema contains an enum field with multiple keys: active and inactive.
Preview Person-Schema

Toggle off the Expression button in the Expression Builder, then select the field with multiple keys, and a dropdown list of the multiple keys in that field.


Mapper Snap with Expression Builder

Automatically map fields

To let the SnapLogic Platform make the best effort at mapping, click AutoLink. To manually map fields:
  1. Click + to add a row. Drag an element from the Input Schema into the Expression field of the Mapping table . The input changes to an expression.
  2. Drag the appropriate Output Schema field into the target path for the corresponding Input Schema field or enter a value for the target path. If a value already exists, the new value replaces it.
To merge two input fields into one output, select and drag each input field, one at a time, onto one common Expression field. The system combines the two fields into one.
Expression field

Note:

To insert a new line between entries, use the Unicode value of \u000A , as in:

 $element
      + "\u000A" + $element 

To directly map a field from one schema to the other, click and drag the field from either schema to the other, and the mapping is automatically created. You can also drag fields from the input schema to the target path.

Search a Schema in Mapper

To search for a specific field in the input or target schema, enter the specific field name in the search field. You can use the file path wildcards * and ? in a search.

Because searches are based on full key names, not just the node title, searches might also select a node's ancestry. For example, if you have a tree such as:
  • +Parent
    • +Child
      • +Grandchild

Searching for Parent returns all three items because the key names are $Parent, $Parent.Child, and $Parent.Child.Grandchild.

Usability functions

  • Collapse the schema views with the gray arrows in the header row for a larger Expression and Target path columns.
  • Click the down arrow in an expression field to access the expression editor, functions and properties, and the upstream schema. Click the bubble in the Target path field to access the downstream schema suggestions.
  • Rearrange the rows in the mapping table by:
    • Highlighting the left side, clicking, and dragging.
      Expression-enabled fields

    • Mousing over a row until a selection arrow appears, then dragging it to a new location.