Help files

Variable Manipulation – Expressions - The ‘%’ Character

Variables are used within Processes to store data for further processing; almost every Action receives at least one Variable as input, or produces one as output.

Every Variable has a unique name. Variable names may contain letters, numbers, and underscore (‘_’) characters, and are not case sensitive.

Some examples:

  • %NewVar%

  • %webpagedata%

  • %Index3%

  • %File_Path%

Variables can contain different kinds of data; to accommodate this, there are multiple Variable Types. However, Variable Types are automatically and dynamically assigned to Variables, which means that the User may use them as they wish – the Variables will automatically change types according to their content.

Note that each Variable name is enclosed by percentage signs (‘%’). The percentage sign is used as a special character; its most common use is to denote variables. However, its use is much more general: any expression between percentage signs should be evaluated; expressions may contain hardcoded values, variables, and operators.

Below are some simple examples of expressions and their values:

Expression

Value

%4%

4 (number)

4

4 (text)

%4 + 5%

9 (number)

4 + 5

4 + 5 (text)

Sample

Sample (text)

%Sample%

The contents of the Variable named “Sample”

%Sample + 5%

The contents of the Variable named “Sample”, increased by 5

%Sample1 / Sample2%

The contents of the Variable named “Sample1”, divided by the contents of the Variable named “Sample2”

%Sample1 == Sample2%

“True” if the contents of the Variables named “Sample1” and “Sample2” are equal, otherwise “False”

%Sample% Sample

The contents of the Variable named “Sample” and the word Sample.

Note

In some cases, the percentage sign should be used as a simple character, instead of denoting a calculation. In those cases, it should be escaped, using the backslash (‘\’).

Expressions

An Expression may contain any valid combination of following elements:

  1. Hardcoded Values: 5, 0.14, “This is text”

  2. Variable names: NewVar, Index1

  3. Arithmetic operations: +, -, *, /

  4. Comparisons: ==, !=, <, <=, >, >=

  5. Logical operations: &&, ||, !

  6. Parentheses: ()

1. Hardcoded Values

Simply including a value within percentage marks will allow it to be part of an expression. Note that text values must be included in quotes, otherwise they will be interpreted as Variables:

%Text%

The value of the Variable named “Text”

%”Text”%

The text string “Text”

2. Variable Names

Variables can be used by adding their name to the Expression without any further notation, as in the example above.

3. Basic arithmetic

Basic arithmetic operations can be used in expressions: Addition (+), Subtraction (-), Multiplication (*) and Division (/).

Arithmetic operations are designed to be used with Numerical values and Variables; however, the Addition operator can also be used between text strings, to concatenate them. Adding numbers and text strings in the same Expression will convert the numbers into text, and concatenate them with the other text strings

%5 * 3%

15 (number)

%4 / Var%

4 divided by the value of the variable named “Var”

%”this is “ + “text”%

this is text (text)

%”This is the number “ + 5%

This is the number 5 (text)

4. Comparisons

The following comparison operators are supported:

Equal/not equal

==, !=

Less than/less than or equal

<, <=

Greater than/greater than or equal

>, >=

Keep in mind that comparisons, when evaluated, produce either “True” or “False” as a value.

%4 != 5%

True

%6 >= 5%

False

%5 < 4 + 3%

True

%”abc” == “abcd”%

False

Naturally, comparisons can only be performed between values of the same Type.

5. Logical operators

Logical operators can also be used to simultaneously check multiple conditions, allowing for more complex logic to be implemented in a single Expression.

The operators are:

  • AND using &&

  • OR using ||

  • NOT using !

%Index == 1 || Index == 2%

True if the value of the “Index” Variable is 1 OR 2, otherwise False

%Index == 4 && Text == “Four”%

True if the value of the “Index” Variable is 4 AND the value of “Text” is “Four”, otherwise False

%!ConditionIsTrue%

True if the value of the “ConditionIsTrue” Variable is False, otherwise False

6. Parentheses

Parentheses can be used to group different values and operations, to aid with larger and more complex operations.

%(Value1 + Value2) / 2%

%!(Value > 5 && Value < 10)%

%((Value1 + 1) * (Value2 + 1)) == (Value3 * 4)%