Boolean. Data type of the variable.(Power Automate Cloud flows)

09/07/2023

Japanese version.

A variable is an element used in programming that is like a box in which data is named and stored,

They can store a variety of data with certain restrictions.

The ability to utilize variables makes a big difference in what you can do with Power Automate.

Boolean variables handle whether the condition is True or False.

How to use

To use a variable, it must first be initialized. Without initialization, the variable will not be registered as a variable.

To do so, select the "Variable" connector under "Built-in" when adding a step to the flow.

Select "Initialize variable" from the "Actions" menu.

Specify the name and type of the variable.
Select "Boolean" for the type.

The value is the content of the variable to be specified first.
Set true or false.This can be left unset.
If unset, the content of the variable will be false.

Set value

Fixed value

To set a value to a variable, use the "Set variable" action in the "Variable" connector.

Then set true or false in the value field.

Logical functions

Logical functions can be used in expressions to store the result of a decision.

For example, the equals function stores True if two values are the same and False if they are different.

Using "condition" actions makes it difficult to see the flow.

If it is more organized to use logical functions and variables, use these.

Use variables

Include in Logic Functions

Boolean variables can also be included in logical functions.

This allows for complex decisions with minimal conditional control.

To do this, either select the variable from the dynamic content when setting up the expression, or specify the variable name enclosed in ' in the variables function.

However, the variable to be set cannot be incorporated into the expression.

Include in Condition

It is possible to include it in a "Condition" action. In this case, specify a boolean variable on one side and true on the other.

False is also possible, but should be avoided, since the "If no" becomes a double negative, which is difficult to understand.

If the "If yes" and "If no" actions themselves change, the "Condition" action is better.
Conversely, if the action is the same but the parameters change, it is preferable not to use the "Condition" action.

For example, if an email is sent but the content is different, it is simpler to store the result of the if function in a variable and process the resulting variable in a single action in the flow.

The first argument of the if function is a Boolean variable (the name of the variable enclosed in ' in the variables function), The second argument is the value that corresponds to the "If yes" case, and the third is the value that corresponds to the "If no" case.

---

Links

Introduction(Power Automate Cloud flows)