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

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:


Account: 

Accounts are not used with this Snap.


Views:


InputThis Snap has exactly one document input view.
OutputThis Snap has exactly one document output view.
ErrorThis 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
nameSnap Execution
pageAnaplan Read

Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read

Troubleshooting


If a Pivot field has a space in the name, it should be enclosed by braces and single quotes ( [' ']). For example, $['House Rent'] instead of $House Rent

Example


The input documents to the Pivot Snap are as follows:

Code Block
[
    {
      "person": {
        "Name": "Sam",
        "Month": "Jan",
        "Transportation": 200,
        "House Rent": 1500,
        "Internet": 100,
        "Food": 500
      }
    },
    {
      "person": {
        "Name": "John",
        "Month": "Jan",
        "Transportation": 300,
        "House Rent": 1200,
        "Food": 300
      }
    },
    {
      "person": {
        "Name": "Tom",
        "Month": "Jan",
        "Transportation": 300,
        "House Rent": 1350,
        "Food": 350
      }
    },
    {
      "person": {
        "Name": "Sam",
        "Month": "Feb",
        "Transportation": 300,
        "House Rent": 1550,
        "Food": 450
      }
    },
    {
      "person": {
        "Name": "John",
        "Month": "Feb",
        "Transportation": 350,
        "House Rent": 1200,
        "Food": 290
      }
    },
    {
      "person": {
        "Name": "Tom",
        "Month": "Feb",
        "Transportation": 350,
        "House Rent": 1400,
        "Food": 350
      }
    }
]

The output documents of the Pivot Snap are as follows:

Code Block
[
  {
    "person": {
      "Name": "Sam",
      "Month": "Jan"
    },
    "Expense": "person.Internet",
    "Amount": 100
  },
  {
    "person": {
      "Name": "Sam",
      "Month": "Jan"
    },
    "Expense": "person.Food",
    "Amount": 500
  },
  {
    "person": {
      "Name": "Sam",
      "Month": "Jan"
    },
    "Expense": "person.House Rent",
    "Amount": 1500
  },
  {
    "person": {
      "Name": "Sam",
      "Month": "Jan"
    },
    "Expense": "person.Transportation",
    "Amount": 200
  },
  {
    "person": {
      "Name": "John",
      "Month": "Jan"
    },
    "Expense": "person.Internet",
    "Amount": 0
  },
  {
    "person": {
      "Name": "John",
      "Month": "Jan"
    },
    "Expense": "person.Food",
    "Amount": 300
  },
  {
    "person": {
      "Name": "John",
      "Month": "Jan"
    },
    "Expense": "person.House Rent",
    "Amount": 1200
  },
  {
    "person": {
      "Name": "John",
      "Month": "Jan"
    },
    "Expense": "person.Transportation",
    "Amount": 300
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Jan"
    },
    "Expense": "person.Internet",
    "Amount": 0
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Jan"
    },
    "Expense": "person.Food",
    "Amount": 350
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Jan"
    },
    "Expense": "person.House Rent",
    "Amount": 1350
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Jan"
    },
    "Expense": "person.Transportation",
    "Amount": 300
  },
  {
    "person": {
      "Name": "Sam",
      "Month": "Feb"
    },
    "Expense": "person.Internet",
    "Amount": 0
  },
  {
    "person": {
      "Name": "Sam",
      "Month": "Feb"
    },
    "Expense": "person.Food",
    "Amount": 450
  },
  {
    "person": {
      "Name": "Sam",
      "Month": "Feb"
    },
    "Expense": "person.House Rent",
    "Amount": 1550
  },
  {
    "person": {
      "Name": "Sam",
      "Month": "Feb"
    },
    "Expense": "person.Transportation",
    "Amount": 300
  },
  {
    "person": {
      "Name": "John",
      "Month": "Feb"
    },
    "Expense": "person.Internet",
    "Amount": 0
  },
  {
    "person": {
      "Name": "John",
      "Month": "Feb"
    },
    "Expense": "person.Food",
    "Amount": 290
  },
  {
    "person": {
      "Name": "John",
      "Month": "Feb"
    },
    "Expense": "person.House Rent",
    "Amount": 1200
  },
  {
    "person": {
      "Name": "John",
      "Month": "Feb"
    },
    "Expense": "person.Transportation",
    "Amount": 350
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Feb"
    },
    "Expense": "person.Internet",
    "Amount": 0
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Feb"
    },
    "Expense": "person.Food",
    "Amount": 350
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Feb"
    },
    "Expense": "person.House Rent",
    "Amount": 1400
  },
  {
    "person": {
      "Name": "Tom",
      "Month": "Feb"
    },
    "Expense": "person.Transportation",
    "Amount": 350
  }
]

Downloads

Attachments
uploadfalse
oldfalse
patterns*.slp, *.zip

Excerpt Include
Transform Snap Pack
Transform Snap Pack
nopaneltrue