UiPath Activities

The UiPath Activities Guide

System.Activities.Statements.Switch

Description

Enables you to execute a single course of action out of multiple options, based on a preset 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.

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.

Properties

Common

  • DisplayName - The display name of the activity.

Misc

  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.
  • Expression - The statement according to which one of the cases is executed. By default, the variable type supported by this field is Int32. To change the type, select a different option in the TypeArgument drop-down list.
  • TypeArgument - Enables you to select the type of statement that can be added in the Expression property. By default, Int32 is selected.

Important!

This activity is built by Microsoft. For more information, see their official documentation.

System.Activities.Statements.Switch

Description

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.

Configuring the Activity

In the Body of the Activity

  • Expression - Click Plus plus button on the right side of the field and then, from the menu, select the expression using one of the available options:
    • Data from the Project Notebook, a parent Excel file or Outlook account. For example, you can select a cell in an Excel file.
    • Use Saved Value - Select a value you previously saved for later use in the project
    • Text - Enter an expression in the Text Builder.
    • Ask when run - Prompt for an expression when the project is executed.
    • 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.

In the Properties Panel

Common

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

Misc

  • Expression - See Expression in the body of the activity.
  • Private - If selected, the data used in the activity is not logged by StudioX.
  • TypeArgument - Select the type of statement that can be added in the Expression field. The default option is String.

Updated 5 months 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.