Unsupported content

 

This version of the product has reached end of support. The documentation is available for your convenience. However, you must be logged in to access it. You will not be able to leave comments.

While activity

The While activity allows for a conditional loop within a process that evaluates for the specified conditions and, based on the conditions, perform specified operations.

You can use the While loop to specify the looping conditions, evaluate for the conditions and, when true, perform the activities in the loop, then loop back to evaluate the next item for the conditions. When setting up the conditions, you can specify that any one condition or all conditions must be met. You can also specify a maximum number of loops at which the While loop terminates in the case of an infinite loop (to prevent it).

When you place a While activity on the BMC Atrium Orchestrator Development Studio process canvas, an End While object is automatically placed to the right of it. You link a While activity to a series of activities, terminating at the End While object. The process evaluates for the specified conditions (one or more) and when the conditions are met (true), executes the activities between the While and While End objects, then loops back to evaluate the next item for the specified conditions. This loop repeats until the the condition results return false or the maximum loop count is met and then the process continues with the activities that follow the While End object.

When you delete a While activity, all activities connected to the While activity, including the While End object, will be deleted as a group. You cannot delete the While End object individually. You can delete individual activities contained between the While and the While End objects can be deleted.

The Property Panel for a While activity consists of four tabs, Properties, Logging, Metadata, and Results. The Logging, Metadata, and Results tabs follow the layout and principles outlined in other Activity properties.

To configure a While activity

  1. On the BMC Atrium Orchestrator Development Studio process canvas, double-click the While activity to open the Property Panel (it opens at the Properties tab).
  2. In the Input panel, specify the condition matching requirements and maximum loop count as follows:
    • For Match, specify if All or Any of the conditions (specified in the Condition panel) must be met to execute activities in the loop.  
    • Specify the Max Loop Count using one of the following steps.
      • For Numeric, choose Numeric from the menu and then enter the number.

        Note

        Specify integers between 0 and 9 only. If decimals are used, the workflow goes in a compensated state.

      • For a context item, click the Browse button to launch the Context Browser and then browse for and select the context item.
  3. In the Output panel, select a Context item in which to store the loop iteration count or click Edit to create a new Context item (or edit the name of an existing one).
  4. Specify one or more conditions that must be met to execute the activities inside the While loop using the following steps:
    1. Click the Add  button above the Conditions table. The Condition panel opens.
    2. In the Condition ID field, enter a name for the condition.
    3. In the Parameter type menu, choose one of the following:
      • Context item: Uses a value from a context item to this context item. Click the Browse button to launch the Context Browser and then browse for and select the context item or click Edit to create a new Context item (or edit the name of an existing one).
      • Module configuration: Uses a module configuration item or group. You can select any item in the Module Configuration hierarchy tree. Selecting leaf nodes enables you to select an individual configuration item. Selecting a non-leaf node enables you to select an XML document containing all children of that node.
      • Dynamic context: Assigns a dynamic context to a context item. Use the Context Browser button to add the context item containing the name of the dynamic context item.
    4. Set up the Parameter using a transform editor. Choose Basic or Advanced to open a transform editor. Continue as follows:

    5. When you finish adding the condition, click OK.
    6. Repeat this process to specify all conditions.
  5. Click OK to save the contents of the Properties tab.

On the Property panel you can also define success criteria on the Results tab and additional logging criteria on the Logging tab. For more information, see Activity properties.

Using the Basic transform editor to set up a condition

While adding the condition, you can use the Basic transform editor to set up the condition parameters. This example explains how to set up a context item operand to create a Less Than condition.

  1. From the Transform editor menu, choose Basic.
  2. Choose a function from the Function menu. 
    This example uses the Logical Less Than function. 
  3. Enter the operand values associated with the function in the Operands fields.
    This example uses one value: 10, indicating that the condition to be met is that the value being input is less than 10. 
  4. Click OK.
    The value appears in the Condition panel, as shown in the next example.
  5. Continue with step 4e above (clicking OK to save the condition).

See Basic transform editor for more information about using the Basic transform editor.

Using the Advanced transform editor to set up a condition

While adding a condition, you can use the Advanced transform editor to set up the condition parameters. This example explains how to set up two context item operands to create a Not Equal To condition.

  1. From the Transform editor menu, choose Basic.
    The Transform Editor Setup wizard opens to Step 1 Sample Source.
  2. Click Next to skip this step.
    The wizard proceeds to Step 2 Template. 
  3. Click Next to skip this step.
    The wizard proceeds to Step 3 Token. 
  4. Click the Add  button to add a token.
  5. In the new row, double-click in the Context Name column to add the 2nd operand. 
  6. In the Context Browser window, click New to create the 2nd operand.
  7. Name the context item and click OK.
    In this example, the 2nd operand is called secondOperand
  8. Click Select to select the new operand and add it.
  9. In the same row, double-click in the Token Name column and enter the token name.
    In this example, the token name is OP2.
  10. Double-click in the Value cell and enter the value.
    This example uses the value 4
  11. Click Finish to save the token.
    The XPath Transform Editor window opens. The new token appears in the window.
     
  12. From the Groups menu, choose Operators.
  13. From the Functions menu, choose Not equal
  14. Click Insert
  15. From the Tokens menu, choose OP2
  16. Put your cursor in front of the entry in the text field and enter a period (.) followed by a space.
    The period represents the first operand (called firstOperand in this example). It should look similar to the following example.

    The statement now means firstOperand is not equal to secondOperand.
  17. Click Save and Exit.
    The transform appears in the Condition panel, as shown in the next example.
     
  18. Continue with step 4e above (clicking OK to save the condition).

See Advanced transform editor overview for more information about using the Advanced transform editor.

Related topic

While loop example: Look up available hostname

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Comments