Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
panelIconIdatlassian-info
panelIcon:info:
bgColor#E3FCEF

Please read the Terms of Use for Materials on ZennoLab

Table of contents

Expand
titleClick here to expand the table of contents
Table of Contents
minLevel1
maxLevel7
exclude^Оглавление$

...

Description

The Switch statement operator is an extended version Условие "Если of the IF ("If ... то then ..." (Оператор "IF"condition) ...

If the “IF” IF statement has only two outcomes - True or False (green or red branches), then Switch has the ability to choose several options. In the absence of the desired option, the cube will be released on the “Default” branch.

...

How to add an action to a project?

Via the context menu Add ActionLogicSwitch

...

Or use smart search .

...

What is it used for?

  • Choosing an option from the list

  • Checking for a specific occurrence (match)

...

How to use the action?

...

...

Variable

Here you need to specify the variable that we will check

Info

Starting from version 7.4.0.0, you can immediately create a variable from this field (before that you could only select from the existing ones).

List of conditions

Here you need to specify the exit conditions. The value from the variable will be compared with each of the conditions and, if a match is found, it will be released on the corresponding branch.

As a condition for the exit, you can use not only hard-coded text, as in the examples above (A, B, C, D, E), but also other variables:

...

...

Variable

...

Default

If no matches are found, the action will be released on the Default branch.

If the Default branch is not connected to any of the actions and execution falls on it, then the action will fail.

Example

...

Usage example

Imagine a situation in which we have a value for the switch_test variable.

Next, let's create operations Notification (Notification / Logging) for each of the options.

Example video

...

Expand
titleFor those who want to work with C # code

You can implement similar functionality via C # C # C# C# code (C sharp code .net)

Sample code for the option above

Code Block
languagec#
string switch_var = project.Variables ["switch_test"]. Value;
switch (switch_var) {
case "A":

project.SendInfoToLog ("ВThe variable переменнойcontains заключенаthe букваletter A", true);
break;
case "B": 
project.SendInfoToLog ("ВThe variable переменнойcontains заключенаthe букваletter B", true);
break;
case "C": 
project.SendInfoToLog ("ВThe variable переменнойcontains заключенаthe букваletter C", true);
break;
case "D": 
project.SendInfoToLog ("ВThe variable переменнойcontains заключенаthe букваletter B", true);
break;
case "E":

project.SendInfoToLog ("ВThe variable переменнойcontains заключенаthe букваletter E", true);
break;
default:
project.SendInfoToLog ("НеNecessary match обнаруженоwas нужноеnot соответствиеfound, значениеvariable переменнойvalue: " + project.Variables ["switch_test"]. Value, true);
break;
}

Работа с переменными

Окно переменных

...

...

...