# Mapping matching loops

Map an input loop to a matching output loop.

## Before you begin

You have created a map with an input and output structure. For this example, you can use Other Projects &gt; Examples &gt; Structures &gt; Simple &gt; MaAndPaSupplier &gt; MandPPOFile as input and Other Projects &gt; Examples &gt; Structures &gt; Simple &gt; POStandard &gt; SimpleShipNoticeFile as output.

## About this task

In this example, the input PurchaseOrder loop needs to be mapped to the output Notice loop.

This map is available in Other Projects &gt; Examples &gt; Maps &gt; Looping &gt; LoopSimple.

## Procedure

1. Drag the input PurchaseOrder to the output Notice.

   The Num element is mapped automatically, and a SimpleLoop function is added to the Notice loop and uses a reference to the input PurchaseOrder loop as an argument. ![](https://help.qlik.com/talend/en-US/data-mapper-user-guide/Resources/images/matching_loops_01_notice.png)
2. Drag the input LineItems to the output Items.

   The elements are mapped automatically and a SimpleLoop function is added to Items.
3. Optional: Map other elements as needed.

## 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:

```
<Notices>
  <Notice>
    <Num>1</Num>
    <Items>
      <PartNum>1</PartNum>
      <Quantity>1</Quantity>
    </Items>
    <Items>
      <PartNum>2</PartNum>
      <Quantity>13</Quantity>
    </Items>
  </Notice>
  <Notice>
    <Num>1</Num>
    <Items>
      <PartNum>89</PartNum>
      <Quantity>500</Quantity>
    </Items>
    <Items>
      <PartNum>10S334</PartNum>
      <Quantity>1000</Quantity>
    </Items>
  </Notice>
  <Notice>
    <Num>2</Num>
    <Items>
      <PartNum>1A6</PartNum>
      <Quantity>100</Quantity>
    </Items>
    <Items>
      <PartNum>558</PartNum>
      <Quantity>130</Quantity>
    </Items>
  </Notice>
</Notices>
```