Skip to main content Skip to complementary content

Splitting a loop

Split a loop into two separate loops.

Before you begin

You have created a map with an input and output structure. This example uses the same map as in Unrolling a loop.

About this task

In this example, you have mapped the input Component element and you want to include in your output structure two recursive SubComponents loops on the same level as Components.

Procedure

  1. If you are using the map created in the previous example, right-click the output Components[2] element and click Remove Expressions (Mappings).
  2. In the input structure, expand the recursive SubComponents loops to display two levels of loops with their children.
    Your map should look like this:
  3. Right-click the Components[2] loop and click Split Loop.
    This creates a new identical loop on the same level.
  4. Drag the first input SubComponents loop on the output Components[2].
    The elements are mapped and a SimpleLoop function is added to the output looping element.
  5. Drag the input child SubComponents loop to the output Components[3].
    The elements are mapped and a SimpleLoop with a NestedContext is added to the output looping element.

Results

The loops are mapped, you can use the Test Run button to see the output based on the sample input file. In this example, the output looks like this:
<FlatComponents>
  <Row>
    <Components>
      <Id>1</Id>
      <PartNumber>45I1122</PartNumber>
      <Quantity>1</Quantity>
      <Description>Main Component</Description>
    </Components>
    <Components>
      <Id>102</Id>
      <PartNumber>12ZSSS</PartNumber>
      <Quantity>5</Quantity>
      <Description>Door Assembly</Description>
    </Components>
    <Components>
      <Id>302</Id>
      <PartNumber>12IQWO</PartNumber>
      <Quantity>14</Quantity>
      <Description>Window Assembly</Description>
    </Components>
    <Components>
      <Id>201</Id>
      <PartNumber>88-B</PartNumber>
      <Quantity>2</Quantity>
      <Description>Hinge</Description>
    </Components>
    <Components>
      <Id>202</Id>
      <PartNumber>GF4488-B</PartNumber>
      <Quantity>1</Quantity>
      <Description>Lock</Description>
    </Components>
    <Components>
      <Id>203</Id>
      <PartNumber>288333-I10023</PartNumber>
      <Quantity>1</Quantity>
      <Description>Sign</Description>
    </Components>
    <Components>
      <Id>401</Id>
      <PartNumber>88-C</PartNumber>
      <Quantity>2</Quantity>
      <Description>Window Lock</Description>
    </Components>
    <Components>
      <Id>402</Id>
      <PartNumber>RT433</PartNumber>
      <Quantity>1</Quantity>
      <Description>Window Frame</Description>
    </Components>
    <Components>
      <Id>403</Id>
      <PartNumber>15</PartNumber>
      <Quantity>1</Quantity>
      <Description>Glass</Description>
    </Components>
  </Row>
</FlatComponents>

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!