Adding a loop function

You can only drop a loop on a mapping or on another loop function where the latter yields a nested loop.

See Function elements overview.

Note: When connecting elements, you can drop elements only where it is acceptable.
  1. Double-click a mapping to open it in the Mapper Editor.
  2. From the Core Functions pane in the Palette tab, select and drag the loop in your mapping.
  3. Drag and drop the circular function element to the space between the input and output document trees.
  4. Connect a controlling link for your loops.

    You can control a loop by using a repeating input document element, a UBJ function, or a repeating external function (M3 API).

    Use the loop to create repeating elements in the output document by linking the loop to a repeating output document element.

    For example, you can drag a repeating input document element to a loop and then drag the loop to a repeating output document element. You can also drag the output element to the loop. The output repeating element repeats as many times as the input repeating element does.

    This table shows how the source element type of the link that controls the loop defines the loop condition:

    Loop condition Possible loop action
    The source is a repeating input document element:
    • Execute for each occurrence of the element

      (WHILE_TRUE, Execute loop FOR EACH element)

    The source is a UBJ function:
    • Execute while the function returns true

      (WHILE_TRUE, Execute loop WHILE function is TRUE)

    • Execute while the function returns false

      (WHILE_FALSE, Execute loop WHILE function is FALSE)

    The source is an external function (M3 API):
    • Execute for each record returned by the function

      (WHILE_TRUE, Execute loop for EACH record returned by a list program)

  5. Right-click a loop and select Properties.
  6. Select the condition for your loop.
    Note: Expand the Condition property to select the LoopExecution value.
  7. Specify the information for your parameter properties:
    Condition

    See loop conditions in the table.

    Description

    Provide a brief description.

    Name

    Specify a name.

    The default value is Loop.

  8. Select File > Save to save the loop into your mapping.
    Note: If you select a condition so that the loop is only run once, then the Loop function becomes an If function.