Creating a Loop

You can create a loop to iterate through a complex activity.

  1. Build a complex activity in your business process.
  2. Select the complex activity to see its properties.

    Properties display in the Properties section of the Business Process Logic Page.

  3. Select the Iteration Settings tab.
  4. Select the This activity runs iteratively option to create a loop.
  5. Create a counter variable.
  6. Define the counter variable:
    1. In Properties, click the ellipsis the ellipsis box 
      in the Counter variable field.

      The Variable Reference Dialog opens.

    2. Select the variable that you want to use and click OK.

      If the Counter variable is set, the loop automatically increments the counter variable by one at the bottom of each loop. If you want to increment by a different amount or if you want to decrement, then the Counter increment must be set. The Counter initial value allows the Counter variable to initialize before loop execution.

    3. Define the Counter initial variable and the Counter increment variables:
    1. In Properties, click the ellipsis the ellipsis box 
      in either the Counter initial or Counter increment field, whichever you are populating.

      The Variable Reference dialog opens.

    2. Choose one of the following:
    Option Action
    Variable Select the variable that you want to use and click OK.
    Literal Enter the value in the Literal field and click OK.
  7. Define a single rule for the loop.

    You must define a rule for loop evaluation. The loop executes as long as the rule evaluates to true. Usually, a counter variable is used in the rule for the loop; however, this is not required. Any rule that evaluates to either true or to false is supported.

  8. Complete the flow of the business process logic inside the loop:
    1. Maximize the complex activity.
    2. Add the activities from the Tool Palette that complete the logic.
    3. Connect the activities to determine the flow of execution.
    4. Minimize the complex activity.

    The center of the activity icon is decorated to reflect the loop.

  9. Select File > Save from the main menu bar.
Related tasks
Building a Complex Activity
Defining Business Process Variables
Defining Business Process Correlation Sets
Related reference
Example Procedure for Acting on Repeating Elements in Data

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.