Case Action—Setting Properties

The Case action is used in conjunction with the Select action. You use the Select action to set up an expression that can be evaluated to any of several results. You then set up a Case action for each possible result.

The Select/Case block begins with the Select step containing the expression. This is followed by several Case blocks. Each Case block starts with a Case step that specifies a possible result of the expression. If the result of the expression matches the case, then the steps following the Case step are executed up to the End Case step. You create one Case block for each possible result of the expression.

When you create a Case step, an End Case step is created automatically. Place the steps to be executed between the Case step and the End Case step.

The optional final Case block is the default case, which contains the steps to be executed if the expression result does not match any of the cases. The default Case Step and End Case step are created automatically when the Select step is created. Place the steps to be executed between the default Case and the End Case steps.

The steps between each Case step and End Case step should be indented for visual clarity.

To set Case action properties

  1. From the Task Builder Available Actions pane, open the Flow folder and double-click the Case action or drag it into the Steps pane.

  2. Enter the value for the expression result.

    or

    If you are entering the default case step, select Default case.

  3. To set the Description tab properties, refer to Description Tab Options.

  4. To set the Error Causes and On Error tab properties, refer to Step Error Handling.

  5. When finished, click OK to save settings and close the properties dialog window.

To auto-indent after all steps are added

  1. In the Task Builder Steps pane, hold down SHIFT and click the first and last steps in the block so that the complete block of steps is selected.

  2. Click the Format button .

 

Select/Case example

Create a Choice step where a user can enter input, and the input populates a variable. Then create a Select step that specifies the user input variable as the expression. Then set up a series of Case blocks where each Case step contains a possible user answer and is followed by steps appropriate to that answer.

Sample Step Descriptions

Create a variable named "choice".

Display a message box containing checkboxes for the items: "one,two,three,four" (corresponding values: "1,2,3,A").  Display the text "please select one of the following".  The title of the message box is "please select one of the following".  The user can select ok without choosing any item.

Select a following case based on the result of expression: %choice%

     Case 1

          Display the message "You have selected one" in a message box.

     End Case

     Case 2

          Display the message "you selected two" in a message box.

     End Case

     Case 3

          Display the message "you selected three" in a message box.

     End Case

     Case A

          Display the message "You selected four" in a message box.

     End Case

     Default Case

          Display the message "you didn't make a selection" in a message box.

     End Case

End Select block

See Also

About Actions

Adding Task Steps

Select Action-Setting Properties

Select/Case Action

End Case Action-Properties