Creating a Loop

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

To create a loop:

  1. Build a complex activity in your business process.

  2. Select the complex activity to see its properties.

    Its activities appear either in the Properties section of the Business Process Logic Page or the Properties Panel view.

  3. Select the Iteration Settings tab.

  4. Select the This activity runs iteratively option to create a loop.

    A local variable of data type integer named counter is automatically generated in Business Process Variables section. If a variable of the same name already exists, the variable is not regenerated.

  5. Define the Counter variable:

    1. In Properties, click the ellipsis box in the Counter variable field.

      The Variable Reference Dialog appears.

    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 box in either the Counter initial or Counter increment field, whichever you are populating.

        The Variable Reference Dialog appears.

      2. Do one of the following:

        • Select Variable, select the variable that you want to use, and click OK.

        • Select Literal, enter the value in the Literal field, and click OK.

  6. 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.

  7. 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.

  8. Save the service. Select File|Save from the main menu bar.

Acting on Repeating Elements in Data

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com