...
Table of Contents | ||||
---|---|---|---|---|
|
...
Snap type:
Transform
...
Description:
This Snap converts selected columns in the input document to the rows in the output document. The attached example pipeline illustrates the function of this Snap.
Expected upstream Snaps: Any Snap with a document output view.
Expected downstream Snaps: Any Snap with a document input view.
Expected input: Stream of documents with a nested or flat map data.
Expected output: Stream of documents with a pivoted map data.
...
Prerequisites:
[None]
...
Support and limitations:
...
Works in Ultra Task Pipelines.
...
Account:
Accounts are not used with this Snap.
...
Views:
Input | This Snap has exactly one document input view. |
---|---|
Output | This 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. |
...
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.
Pivot fields
Required. A table for the pivot field definitions including the pivot field path and the Snap behavior when the field is absent. If there are N rows in this table property, there will be N output documents per each input document.
...
Pivot field
JSON path to a field in the input document to be converted to a row in the output document. Select one from the suggested list.
Example: $Internet
Default value: [None]
...
If field absent
Select a Snap behavior if the Pivot field is absent. The options available include Ignore, Substitute null, Substitute empty string and Substitute zero.
Example: Substitute zero
Default value: Ignore
Target field
Required. JSON path to a target field in the output document. This property can be selected from the suggested list if the downstream Snap provides the input schema, for example, Salesforce Create Snap.
Example: $Expense
Default value: [None]
Target value
Required. JSON path to a target value in the output document. This property can be selected from the suggested list if the downstream Snap provides the input schema, for example, Salesforce Create Snap.
Example: $Amount
Default value: [None]
...
Target field full path
...
If true, the Target field is a full JSON path to the Pivot field. If false, a leaf key name of the Pivot field.
Example: The example pipeline shown below is with this property set true. Please note the 'Expense' target field in the output document is a full path, for example, "person.Internet". If it were false, the value would be "Internet" instead.
Default value: False
...
Multiexcerpt include macro | ||||
---|---|---|---|---|
|
...
Multiexcerpt include macro | ||||
---|---|---|---|---|
|
Overview
You can use this Snap to convert selected columns in the input document to the rows in the output document.
...
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
|
| The fields to be pivotedDocuments with a nested or flat map data. |
Output | Document |
|
| Stream of documents with a pivoted map data. The pivoted fields. |
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 running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab:
Learn more about Error handling in Pipelines. |
...
Field Name | Field Type | Field Dependency | Description | |
---|---|---|---|---|
Label* Default Value: Pivot | String | None. | Specify a unique name for the Snap. | |
Selected Fields | Use this field set to select fields to be pivoted or remain unchanged in the output document based on the value of the Treat selected fields as static checkbox. | |||
Selected Field Default Value: N/A | String/Suggestion | None. | Specify or select the field to be included in the action. | |
If Field Absent Default Value: N/A | Dropdown list | None. | Select one of the following options to apply for the selected field:
| |
Treat selected fields as static Default Value: Deselected | Checkbox | None. | Select this checkbox to treat selected fields as static in the output document. Selecting this checkbox affects the processing of the input documents and preserves the structure of the selected fields while the remaining fields are pivoted. | |
Target Pivoted Field* Default Value: N/A | String/Suggestion | None. | Specify or select the target pivoted field. | |
Target Pivoted Value* Default Value: N/A | String/Suggestion | None. | Specify or select the target pivoted value. | |
No Pivots Target Field Behavior* Default Value: Substitute null | Dropdown list | Appears when you select Treat selected fields as static checkbox. | Select one of the following options (behavior) you want to apply on the target fields—by default if no fields remain to be pivoted (all fields selected as static).
| |
No Pivots Target Value Behavior* Default Value: Substitute null | Dropdown list | Appears when you select Treat selected fields as static checkbox. | Select one of the following options (behavior) you want to apply on the target fields—by default if no fields remain to be pivoted (all fields selected as static).
| |
Snap Execution Default Value: | Dropdown list | N/A | Select one of the following three modes in which the Snap executes:
|
...
Error | Reason | Resolution |
---|---|---|
If a Selected Field has a space in the name, an error is displayed and the Snap fails. | The Selected field does not support empty spaces. | Enclose the field value in braces and single quotes ( [' ']). For example, |
Invalid default behavior for pivoted target field and target value. | Behavior for one of the Target field or Target value fields cannot be | Select Ignore behavior or non-Ignore behavior for both target field and target value and retry |
Examples
Behavior of Pivot Snap when the default option (Treat selected fields as static) checkbox is deselected
This example Pipeline demonstrates the expected behavior of Pivot Snap when the Treat selected fields as static checkbox is deselected (default option).
...
Next, configure the Pivot Snap to substitute null values for the selected fields ($['2010'], $['2012'], $['2014'], $['2016'],$['2019'],$['2020']
) and deselect Treat selected fields as static checkbox.
...
On validating the Snap, the Snap returns all the fields in the output as per the configured behavior for the Selected fields.
...
Download this Pipeline.
...
Behavior of Pivot Snap when the default option (Treat selected fields as static) checkbox is selected
Scenario 1: Treat selected fields as static checkbox is selected and the selected fields exist in the input
This example Pipeline demonstrates the behavior of the Pivot Snap on the selected fields when you apply Substitute empty strings and Null values for on the target fields, but the selected fields exist in the input document.
...
Selected Fields
$Name
: If this field does not exist, the Snap substitutes an empty string for this field in the output.$[Last Date Available'
]: If this field does not exist, the Snap substitutes null value for this field in the output.
Select the Treat selected fields as static checkbox.
...
On validating the Snap, the Snap generates the output as per the configured behavior for the Selected fields. That is, the Snap generates values for all the fields because the selected fields exist originally in the input document.
...
This example Pipeline demonstrates the behavior of the Pivot Snap on of the selected fields when you apply all the available options (Ignore, Substitute null, Substitute empty string, Substitute zero) on the target fields and the selected fields do not exist in the input document.
...
This example Pipeline demonstrates the behavior of the Pivot Snap on the selected fields when they are nested in the input document.
...
Multiexcerpt include macro | ||||
---|---|---|---|---|
|
Attachments | ||
---|---|---|
upload | false | old | false
|
...
...
Snap Pack History
...