Switch Step

Use the Switch step to cause the program logic to branch to one of a number of cases based on the evaluation of a specified expression.

Switch Customizer Window

A case is a method for providing script logic based on the value of a variable at a point in time. You can assign one case for each value. The Switch step lets you define any number of case output branches. You can then create a separate script logic for each branch.

Note

Use a subflow in a script (instead of a redirect) to transfer a call to another script.

The Switch step supports switching based on the following variables:

  • Integer—Comparison of integers

  • String—Comparison of string variables (case insensitive)

  • Language—Comparison of language variables

Note

The language comparison will attempt the parent language before falling back to default. For example, a match for L[en_US_Judy] will first attempt to match from the following list: {L[en_US_Judy], L[en_US], L[en]}, and then return “Default” if no item in the list matched.

The type of switching is automatically determined by the type of the specified expression.

Steps that you add following a specific case output branch execute if the integer, string, or language expression you specify for that case is equal to the global expression defined in the Switch Expression field.

The Default branch of the step allows you to handle cases where none of the branches matches the expression.

The following table describes the properties of the Switch customizer window:

Properties / Buttons

Description

Switch Value

Variable or expression to be executed.

Values

The list of switch values

Language case for the output branch containing script logic specific to one possible variable value.

Connections

Output label targets to which the script branches when the variable equals the specific values.

Add / Modify (buttons)

Use these buttons to access the Switch Case and Label dialog box.

When done, click OK.

Note

An entry can be directly edited in the table list by double clicking on it. To sort the entries, click on the column header.

Delete (button)

To remove a Switch Case, highlight a value in the list and click Delete.