Skip to end of metadata
Go to start of metadata

Introduction

Loop node iterator lines, which indicate the source and target nodes whose mapped fields a transformation will iterate on, are generated automatically during the mapping process, either when using automapping or when manually mapping source objects to target fields.

Normally, the automatic generation of loop nodes during mapping is appropriate for the data set. However, when the data is such that there are multiple sets of repeating data values — or multiple loop nodes — you may need to manually define a loop node to force the data to loop on a different node. You can also, if needed, remove loop nodes, both those that have been manually defined and those that have been automatically generated.

Defining a Loop Node Manually

Loop nodes can be defined manually on target nodes that meet both of these conditions:

  • The cardinality of the target node must be 0+ or 1+.
  • There must not be any mappings on direct leaf fields within the target node.

In addition, the cardinality of the source node being used to create the target loop node must be 0+ or 1+.

To define a loop node manually, in mapping mode, drag a qualifying source node to a qualifying target node:

On dropping the source node onto the target node, a menu appears. Select the option Define Loop Node:

The loop node is now defined, and the iterator line is displayed, indicating how the transformation will loop through the source data set. (The line is displayed even if there are not yet any direct leaf mappings on fields under the node.) Complete the mapping of fields beneath the loop node as usual:

Removing a Loop Node and Mappings

Options for removing a manually defined loop node or for removing any loop node and its mappings are available within a node's actions menu.

From either mapping mode or script mode, hover over a node name and click the actions menu icon  to open the actions menu. From the menu, select one of these mapping removal options:

Menu ItemDescription

Remove Loop Node removes the loop node definition. This action is available only on nodes that have a manually defined loop node.

To remove a loop node definition on an automatically generated loop node, remove all of its direct leaf mappings as described under Removing a Mapping in Mapping Source Objects.

NOTE: If you remove all of the direct leaf mappings of a manually defined loop node, the loop node definition still exists.

Remove Loop Node and Mappings removes the loop node definition due to mappings that are direct leaf children associated with the loop node, and removes those mappings.

Any other mappings within child loop nodes beneath the parent loop node are preserved, and the node retains its loop node definition if at least one grandchild is mapped.

This action is available only on nodes that have a loop node defined (either manually or by automatic generation). 

Example

This section describes an example, employing the HubSpot connector, that is a use case where redefinition of loop nodes is necessary. In this example, a request transformation provides filters to use in a HubSpot Search activity to query company records. Below, we first show the output when using the automatically generated loop node and then show how the output changes when the loop node is manually redefined.

Automatic Loop Node Generation

After automapping and automatic generation of a loop node, the transformation mapping shows data looping on the target's second item node:

When the mapping above is processed using the below input data, it results in this output, which flattens the input structure into a single list of filters:

InputOutput
{
  "filterGroups": [
    {
      "filters": [
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "AZ INC"
        }
      ]
    },
    {
      "filters": [
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "IQ services"
        },
        {
          "operator": "EQ",
          "propertyName": "hs_object_id",
          "value": "4403735338"
        }
      ]
    }
  ]
}
{
  "filterGroups": [
    {
      "filters": [
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "AZ INC"
        },
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "IQ services"
        },
        {
          "operator": "EQ",
          "propertyName": "hs_object_id",
          "value": "4403735338"
        }
      ]
    }
  ]
}

Manual Loop Node Definition

To change the node on which the data is looping, drag the source's second item node onto the target's first item node and select Define Loop Node:

We now see the loop node iterator line on both the target's first and second item nodes:

When the mapping above is processed using the same input data as was used in the automatic loop node generation, it results in the desired output, which maintains the input structure:

Same InputDifferent Output
{
  "filterGroups": [
    {
      "filters": [
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "AZ INC"
        }
      ]
    },
    {
      "filters": [
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "IQ services"
        },
        {
          "operator": "EQ",
          "propertyName": "hs_object_id",
          "value": "4403735338"
        }
      ]
    }
  ]
}
{
  "filterGroups": [
    {
      "filters": [
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "AZ INC"
        }
      ]
    },
    {
      "filters": [
        {
          "operator": "EQ",
          "propertyName": "name",
          "value": "IQ services"
        },
        {
          "operator": "EQ",
          "propertyName": "hs_object_id",
          "value": "4403735338"
        }
      ]
    }
  ]
}

  • No labels