Structural Transformations

The following structural transformations from the Structure Snap are supported in the Mapper Snap:

  • Move - A move is equivalent to a mapping without a pass-through. The source value is read from the input data and placed into the output data. As the Pass through is disabled, the input data is not copied to the output.  Also, the source value is treated as an expression in the Mapper Snap, but it is a JSONPath in the Structure Snap. A jsonPath() function was added to the expression language that can be used to execute a JSONPath on a specific value. If you enabled Pass through, then you should delete the old value.

  • Delete - Write a JSONPath in the source column and leave the target column blank.

  • Update - All of the cases for update can be handled by writing the appropriate JSONPath. For example:

    • Update valuetarget path = $last_name

    • Update maptarget = $address.first_name

    • Update listtarget = $names[(value.length)]

      • The '(value.length)' evaluates to the current length of the array, so the new value is at the end.

    • Update list of mapstarget = $customers[*].first_name

      • This translates into "write the value into the 'first_name' field in all elements of the 'customers' array".

    • Update list of liststarget = $lists_of_lists[*][(value.length)]

For performance reasons, the Mapper does not make a copy of any arrays or objects written to the Target Path. If you write the same array or object to more than one target path and plan to modify the object, make the copy yourself. For example, given the array "$myarray" and the following mappings:

$myarray -> $MyArray
$myarray -> $OtherArray

Future changes to either "$MyArray" or "$OtherArray" are in both arrays. So, make a copy of the array as shown below:

$myarray -> $MyArray [].concat($myarray) -> $OtherArray

This is true for objects, except you can make a copy with the ".extend()" method as shown below:

$myobject -> $MyObject $myobject.extend({}) -> $OtherObject