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 Snap modifies the structure of an incoming document. It can reuse the source document's data or create new data structures (list/map). When the Snap reuses source data, all untouched values will be preserved after all the operations are executed; so a source path can be moved multiple times. However, a target path cannot be the target of a move, otherwise the pipeline will fail. In addition, if a source path is deleted, then the path will not exist after it is executed. Paths can also be updated and the original value will not be deleted.

Note

If the source and target structures are the same, you do not need to use this Snap.

There are five cases for update: 

Update value - the value is replaced
        Example:


 Source Data Pass Through Source Path Operation Target Path Target Data


Code Block
{
    first_name: "Joe",
    last_name: "Smith"
}


 Yes $first_name update $last_name


Code Block
{
    first_name: "Joe",
    last_name: "Joe"
}



 

Update map - key in map is updated

    Example:

 Source Data Pass Through Source Path Operation Target Path Target Data


Code Block
{
    first_name: "Joe",
    address: {
        street: "12 2nd Ave."
    }
}


 Yes

 $first_name

 update

 $address


Code Block
{
    first_name: "Joe",
    address: {
        first_name: "Joe",
        street: "12 2nd Ave."
    }
}



 

Update list - value is appended to list

    Example:

 Source Data Pass Through Source Path Operation Target Path Target Data


Code Block
{
    first_name: "Joe",
    names: [
        "John", "Sally"
    ]
}


 Yes

 $first_name

 update

 $names


Code Block
{
    first_name: "Joe",
    names: [
        "John", "Sally", "Joe"
    ]
}



 

Update list of maps - value is added to each map of the list
Note: If a list does not have all the same type scalar, map, or list, then the pipeline will fail.
    Example:

 Source Data Pass Through Source Path Operation Target Path Target Data


Code Block
{
    first_name: "Joe",
    customers: [
        {
            last_name: "Smith",
            phone_num: "111-222-3333"
        },
        {
            last_name: "Smith",
            phone_num: "123-456-7890"
        }   
    ]
}


 Yes

 $first_name

 update

 $customers


Code Block
{
    first_name: "Joe",
    customers: [
        {
            first_name: "Joe",
            last_name: "Smith",
            phone_num: "111-222-3333"
        },
        {
            first_name: "Joe",
            last_name: "Smith",
            phone_num: "123-456-7890"
        }   
    ]
}



 

Update list of lists - value is appended to the end of each list
Note: If a list does not have all the same type scalar, map, or list, then the pipeline will fail.

    Example:

 Source Data Pass Through Source Path Operation Target Path Target Data


Code Block
{
    first_name: "Joe",
    lists_of_lists: [
        [ "Sue", "Sally"],
        [ "John", "Sam"]
    ]
}


 Yes

 $first_name

 update

 $list_of_lists


Code Block
{
    first_name: "Joe",
    lists_of_lists: [
        [ "Sue", "Sally", "Joe"],
        [ "John", "Sam", "Joe"]
    ]
}


Prerequisites

None.

Configuring Accounts

Accounts are not used with this Snap.

Configuring Views

InputThis Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
Error

This Snap has at most one document error view and produces zero or more documents in the view.

Troubleshooting

  • None.

Limitations and Known Issues

None.

Modes

Ultra Pipelines: 

Support

  • Works in Ultra Pipelines.Spark mode: Does not work in Spark mode

Known Issues

  • None.

Snap Settings

Label



Required. 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.

Pass Through
 


Required. Determine if data should be passed through or not. If set to yes, then the input data and its structure will be used. However, the output data structure can be changed by setting pass through to [None] - new map or [None] - new list. For example, if the input data is a key/value (map) structure, then the output structure can be changed to a list by setting pass through to [None] - new list and using target paths of list indices ($[0], $[1], $[2], etc).
Options available include:

  • Yes
  • [None] - new map
  • [None] - new list

Default value: Yes


Mapping Table

Required. Source path, operation, and target path to use in the Snap. Source path is the JSONPath to move/delete. Operation is the type of operation to execute (move/delete). Target path is the JSONPath to write a value to in a move operation.

Example

Source Path    | Operation | Target Path

$first_name       |    move       | $name.first

$phone_num     |    delete      |  

$names[2]        |    delete      | 

$names[*].first |  move         |   $first_names

 

Default value none


Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read

Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read

Example Output


 Source Data Pass ThroughNull-safe access Source Path Operation Target Path Target Data


Code Block
{
  "first_name" : "John",
  "last_name": "Smith"  
}


 YesDeselected

 $first_name

move

 $fname


Code Block
[
{
"last_name":"Smith",
"fname":"John"
}
]



Code Block
{
  "first_name" : "John",
  "last_name": "Smith"  
}


 [None] - new mapDeselected

 $first_name

move 

 $fname


Code Block
[
{
"fname":"John"
}
]



Code Block
{
  "first_name" : "John",
  "last_name": "Smith"  
}


 [None] - new listDeselected

 $first_name

move 

$[0].fname 


Code Block
[
[
{
"fname":
"John"
}
]
]    



Code Block
{
  "first_name" : "John",
  "last_name": "Smith"  
}


YesDeselected

$mid_name

move

 $middle

 Pipeline fails


Code Block
{
  "first_name" : "John",
  "last_name": "Smith"  
}


 YesSelected

 $mid_name

move 

$middle 


Code Block
[
{
"first_name":
"John"
"last_name":
"Smith"
"middle":
null
}
]



Code Block
{
  "first_name" : "John",
  "last_name": "Smith"  
}


 YesDeselected

 $mid_name

 delete
 Pipeline fails


Code Block
[  
   {  
      "person":{  
         "first":"John",
         "last":"Smith"
      },
      "id":2
   }
]


 YesDeselected

$person.first 

move 

$first 


Code Block
[
  {
    "person":
  {
    "last":"Smith"
  }
  "id":2,
  "first":"John"
  }
]



Code Block
{
  "first_name" : "John",
  "last_name": "Smith"  
}


 YesSelected$first_name
$first_name

move
move

$name1
$name2 


Code Block
[
  {
    "last_name":"Smith",
    "name1":"John",
    "name2":"John"
  }
]



Code Block
{
  "first_name" : "John",
  "mid_name" : "Alan",
  "last_name": "Smith" 
}


YesDeselected$mid_namedelete


Code Block
[
  {
    "first_name":"John",
    "last_name":"Smith"
  }
]


Examples


See Also

Excerpt Include
Transform Snap Pack
Transform Snap Pack
nopaneltrue