Switch Version 5 (Net)

Action group: Base actions


Description

The action selects the execution of a single branching section from a list of options, comparing them to a match expression.

To add a new conditions click on the "" button in the action.

To add a default transition branch, click on the "" button in the action.

 

Action icon


Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ConditionThe value to be matched against branches“ values to select executing branchRobin.String
Yes
Branch 1 conditionIf matches the condition, the corresponding branch will be executedRobin.String
Yes
Branch 2 conditionIf matches the condition, the corresponding branch will be executedRobin.String
Yes

Special conditions of use

When adding a default transition branch, this branch will be executed if the condition did not match in the other branches.

Example of use

Task

There is a variable with type "String" containing the value "Red".

You need to go to the appropriate branching section and output a message to the log.

Solution

  1. Add switch.
  2. Add message to log.

Implementation

  1. Create a variable "String_ Variable 1" with the type "String", which will be an expression and contain the text "Red".

  2. Open the "Base action" action group.

  3. Move the "Switch" action to the workspace.

  4. Triple-click on the "" button in the action.

  5. Action settings:

    1. "Condition" parameter. Select the variable "Branch 1 condition", the value of which will be checked for compliance with the conditions.

    2. "Branch 1 condition" parameter. Select the result of the expression "Blue", which will be compared with the value in the "Conditions" field of the "Switch" action.

    3. "Branch 2 condition" parameter. Select the result of the expression "Red", which will be compared with the value in the "Conditions" field of the "Switch" action.

    4. "Branch 3 condition" parameter. Select the result of the expression "Black", which will be compared with the value in the "Conditions" field of the "Switch" action.

  6. Place the "Message in log" action with the message "Branch no.1", "Branch no.2" and "Branch no.3" corresponding to the branch number (read action description "Message in log"). 

  7. Click "Start" in the top panel to start the robot.

Result

The algorithm went through branch No. 2 and output the message to the log "Branch No. 2".


 

  • Нет меток