Looping Sample

How to:

Reference:

The looping is defined as the parent group nodes that replicate for each set of constituent child elements. The properties of the parent group node can be set to control this behavior.

The following looping modes can be defined for the group nodes:

The default processing allows for Transformer’s engine to determine looping behavior. When looping is in effect, explicitly or by default, the given group node is repeated for each complete cycle of its child elements. For more information on looping, see Using Mapping Builder.


Top of page

x
Procedure: How to Use Looping Mode That is Set to True

To use looping mode that is set to true:

  1. Create a new Transform project.
  2. Import a Transform Template (.xch) file.
  3. Load the Input Structure.
  4. Click the Mappings tab.
  5. Right-click the b_out group node in the Output pane and select Properties.

    The Output Node Properties dialog box opens.

  6. Select True from the Looping drop-down list and click OK.
  7. Click Test Transform to view the output.
  8. View the b_out group.

    In the output, note that the b_out node is looping three times. This occurs because its looping mode is set to true, so b_out is looping as many times as its children elements are looping.

    In this case, its children elements are looping three times because their mapping paths are repeated in the input file:

    b1_out child is mapped to path 'a/b/b1' 
    b2_out child is mapped to path 'a/b/b2' 

Top of page

x
Procedure: How to Use Looping Mode That is Set to False

To use looping mode that is set to false:

  1. Create a new Transform project.
  2. Import a Transform Template (.xch) file.
  3. Load the Input Structure.
  4. Click the Mappings tab.
  5. Right-click the b_out group node in the Output pane and select Properties.

    The Output Node Properties dialog box opens.

  6. Select False from the Looping drop-down list and click OK.
  7. Click Test Transform to view the output.
  8. View the b_out group.

    In the output, note that the b_out node is not looping. This is because its looping mode is set to false, so b_out looping is disabled even though its children elements are looping.

    In this case, its children elements are grouped under one b_out parent group node.


Top of page

x
Procedure: How to Use Looping Mode That is Set to Aggregate

To use looping mode that is set to aggregate:

  1. Create a new Transform project.
  2. Import a Transform Template (.xch) file.
  3. Load the Input Structure.
  4. Click the Mappings tab.
  5. Right-click the b_out group node in the Output pane and select Properties.

    The Output Node Properties dialog box opens.

  6. Select Agg from the Looping drop-down list and click OK.
  7. Click Test Transform to view the output.
  8. View the b_out group.

    In the output, note that the b_out node is looping twice. This is because its looping mode is set to aggregate, and b_out is looping only for unique parent group nodes.


Top of page

x
Reference: Sample Loop Input File

The following is a sample loop input file.

<?xml version="1.0" encoding="UTF-8" ?>
- <a>
 - <b>
    <b1>value of input element a/b/b1</b1> 
    <b2>value of input element a/b/b2</b2> 
   </b>
 - <b>
    <b1>value of input element a/b/b1</b1> 
    <b2>value of input element a/b/b2</b2> 
   </b>
 - <b>
    <b1>value of input element a/b/b1</b1> 
   </b>
</a>

iWay Software