Case

Purpose

Use the Case action to choose the next action to be performed according to the text string value of a specified variable. This avoids the use of multiple EvaluateData actions.


A screen capture of the Action Case window

Description

If needed, type an identifying label in the State Label field, and a description. Click Input Variable to select a variable or Add a new one. In the When fields type the text strings to be compared with the input variable. If null or blank is a possible value, type two double quotes (""). Type the state label of the action in the corresponding Goto field.

If you want to use wildcards in your case statement, set system variable SV238, (System : Case : Pattern matching allowed) to 1.

Parameters

Possible results

There are no results as such. If the Input Variable contains one of the text strings specified in the When parameters, the next action is the one identified by the corresponding Goto. If the Input Variable contains a text string not specified in any of the When parameters, the next action is the one identified by the Default parameter or, if no Default is specified, the next action in the state table.

ASCII syntax

When using an ASCII editor, you would normally use the CASE statement. The CaseAction statement is included for consistency with the window interface. If you prefer to use the CaseAction statement, code it with these parameters in the following order:

  1. Input variable
  2. Up to sixteen pairs of placeholders and values. The placeholders are "COMPARE_1" through "COMPARE_16". The values are the values against which the input variable is to be compared. The edges that correspond to the placeholders specify the "goto" labels.

For example:

label: "Check Edges"
	CaseAction(in1_n, "COMPARE_1", 1, "COMPARE_2", 2, "COMPARE_3", 3)
	  edge EDGE_CASE_DEFAULT: 	   default_edge
	  edge EDGE_CASE_COMPARE_1:	  comp_1
	  edge EDGE_CASE_COMPARE_2:	  comp_2
	  edge EDGE_CASE_COMPARE_3:	  comp_3
	  edge EDGE_CASE_COMPARE_4:	  comp_4
	  edge EDGE_CASE_COMPARE_5:	  comp_5
	  edge EDGE_CASE_COMPARE_6:	  comp_6
	  edge EDGE_CASE_COMPARE_7:	  comp_7
	  edge EDGE_CASE_COMPARE_8:	  comp_8
	  edge EDGE_CASE_COMPARE_9:	  comp_9
	  edge EDGE_CASE_COMPARE_10:	  comp_10
	  edge EDGE_CASE_COMPARE_11:	  comp_11
	  edge EDGE_CASE_COMPARE_12:	  comp_12
	  edge EDGE_CASE_COMPARE_13:	  comp_13
	  edge EDGE_CASE_COMPARE_14:	  comp_14
	  edge EDGE_CASE_COMPARE_15:	  comp_15
	  edge EDGE_CASE_COMPARE_16:	  comp_16
	;

The parameters and edges are described above under "Parameters" and "Possible results". For more information, see Testing a state table using the debugger.