Subscribe

UiPath StudioX

The UiPath StudioX Guide

Switch

System.Activities.Statements.Switch

Enables you to execute a single course of action out of multiple options, based on a specified condition. The activity consists of a conditional expression and a collection of cases, each containing a corresponding activity or set of activities. The Switch activity executes a single case in the collection, based on its match with the conditional expression. If the condition does not match any of the cases, the Default one is executed.
The Switch activity can be used instead of an If activity if the condition has to be tested against three or more cases.

In the Body of the Activity

  • Expression - Click plus button on the right side of the field and then, from the menu, select the expression using one of the available options:
    • A cell from an Excel file added to a card in the project or from the Excel Workspace. You can select named cells from the menu or select Indicate in Excel and indicate a cell directly from the file.
    • Number - Enter a numeric value.
    • Open in Advanced Editor - Enter a VB expression.

Cases

All the possible sequences out of which a single one is executed based on its match with the provided Expression. You can only have one Default case. If no Default case is added, the project is executed, but the activity does not return any output.

To add a case, click Add new case and then enter a case value. Add the activities to execute inside the case.

Properties

Common

  • DisplayName - The name displayed for the activity in the Designer panel.

Misc

  • Expression - The statement according to which one of the cases is executed. By default, the variable type supported by this field is Object. To change the type, select a different option in the TypeArgument drop-down list.
  • Private - If selected, the data used in the activity is not logged by StudioX.
  • TypeArgument - Enables you to select the type of statement that can be added in the Expression property. By default, Object is selected.

Updated 2 years ago


Switch


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.