Adding a loop function

A loop can only be dropped 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 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.

    A loop can be controlled by a repeating input document element, a UBJ function, or a repeating external function (Database or M3 API), see the table below.

    A loop also allows you 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). Now, the output repeating element will repeat 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 Details
    If source is a repeating input document element then the loop may:
    • Execute for each occurrence of the element

      (WHILE_TRUE, Execute loop FOR EACH element)

    If source is a UBJ function then the loop may:
    • 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)

    If source is an external function (Database or M3 API) then the loop may:
    • 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....

    The Properties tab is displayed.

  6. Select the condition for your loop.
    Note: You need to expand the Condition property to be able to select the LoopExecution value.
  7. Specify this information for your parameter properties.
    Condition

    See loop conditions in the table above.

    Description

    Specify a brief description.

    Name

    Specify a name.

    Default value: Loop

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