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 value:Â
target path = $last_name
Update map:Â
target = $address.first_name
Update list:Â
target = $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 maps:Â
target = $customers[*].first_name
This translates into "write the value into the 'first_name' field in all elements of the 'customers' array".
Update list of lists:Â
target = $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:
|
Future changes to eitherÂ
|
This is true for objects, except you can make a copy with the ".extend()" method as shown below:
|
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.