Variable manipulation

Completed

In previous units, you learned that you need to enclose every variable name in percentage characters to make the platform interpret it as a variable.

The percentage sign is a special character that denotes variables. The platform evaluates any expression between percentage signs as a variable.

Screenshot of a variable with the percentage notation.

If you want to use the percentage sign as a simple character in hardcoded text, combine it with the backslash (\) character.

Power Automate desktop app enables you to create complex expressions containing hardcoded values, variable names, arithmetic operations, comparisons, logical operations, and parentheses. The following example combines Salary and Bonus and checks to see if they're greater than Average, producing Boolean output.

Screenshot of an expression with arithmetic and logical operators.

Hardcoded values

While developing flows, you might need to include hardcoded text values in expressions. To enter a hardcoded value, use single quotes. The flows treat every value between quote characters as a text value rather than a variable name.

Screenshot of a hardcoded text variable as an action parameter.

Variable names

If you want to use multiple variables in an expression, add their names to the expression without any further notation. In the following example, the code adds Name to LastName with a single space in between.

Screenshot of an expression with two variables name.

Basic arithmetic

To perform mathematical operations, use Power Automate desktop app's arithmetic operators, such as addition (+), subtraction (-), multiplication (*), and division (/).

Besides arithmetic operations with numerical values and variables, you can use the addition operator to concatenate strings. When you add numbers and text strings in the same expression, the numbers convert into text and join with the other text strings.

Screenshot of an expression with arithmetic operator.

Comparisons

Besides arithmetic operators, you can make comparisons by using the following relational operators:

Operator Description
=, != Equal/not equal
<, <= Less than/less than or equal
>, >= Greater than/greater than or equal

Screenshot of an expression with relational operator.

Note

Comparisons return either True or False as a value. You can only perform comparisons between values of the same type.

Logical operators

In many flows, you need to check if a value meets some particular standards. To check conditions and implement more complex logic in a single expression, use the logical operators. The supported operators are AND and OR.

Screenshot of an expression with logical operator.

Parentheses

When you create complex expressions, you might want to prioritize some specific parts of the expression. To change an operator's priority, use parentheses. Power Automate desktop app handles parentheses the same way as algebra and programming languages.

Screenshot of a complex expression with parentheses.