Create Loops

Create loops to iterate over lists or arrays. Using the loop logical notation, you can create three different types of loops, namely For, Some, and Every.

  • For: Iterates over a list and returns an expression.
  • Some: Checks if at least one list item satisfies the test condition defined by an expression and returns a Boolean value.
  • Every: Checks if every list item satisfies the test condition defined by an expression and returns a Boolean value.

To create a decision with the Loop logic:

  1. Add a new decision element to the model.
    1. In graph view, click Expand Expand/Collapse icon next to Decision on the diagram palette. Select Loop and drag it onto the canvas. Double-click the element to edit its logic. You can also edit the loop's logic from the properties pane; select the element, then select Open Properties Open Properties icon, and in the properties pane click Edit Edit icon next to the Name field.

      Click Close Close icon to return to the canvas.

    2. In list view, click Add new decision Add New Decision icon in the Decisions bar and select Loop from the Create Decision window.

    An empty loop decision is created.

  2. In the Operation column, choose the type of loop to create from the drop-down menu. In the corresponding expression field, enter the loop variable.
  3. In the in field, enter the list or array over which to iterate. In the return or satisfies fields, enter the expression to return (For loop) or the test expression (Some and Every loops), respectively. Press Ctrl+Space to view an auto-suggest menu. You can use any decision outputs, variables, functions, and keywords listed in the menu to define expressions in the in, return, and satisfies fields. Use the FEEL syntax to define expressions.
  4. If necessary, change the logical notations for return and satisfies fields to create a nested logic. These fields have the expression notation selected by default. Click Change bodyChange body icon and select a different notation from the available options. Configure logic for the selected notation. From the Change body menu, you can also cut or copy a notation from these fields and paste it into another identical field within the model.
  5. Furthermore, for a For loop, you can add an additional condition, where, using the Add Condition button.
  6. After the decision logic is complete, click Save to save and validate changes manually. Changes you make within the decision model are also automatically saved and validated from time to time. Errors, if any, are displayed within the decision.