Scenario expressions

Overview

An expression is a sequence of arithmetic or string operations specified by the script author, which operates on constants, variables and functions from them, including functions with side-effects. The expression is used to substitute as an argument to the value of the script components.

The result of the expression can be of type term or number. Dates are also presented as strings in the format RFC3339.

Values of type bool are automatically converted to the string true or false on output. With the ifelse(bool,any,any) function, the result can be converted to other values, e.g., the numbers 0 or false 1.

To use the value of a variable as an argument of an expression, you must specify its name in square brackets.

To explicitly specify a string, you should enclose the text in quotation marks. Otherwise, all arithmetic combinations available for calculation will be calculated first. In examples 2.3 and 2.4, the result will be different, i.e. the beginning of the resulting string of example 2.3 will be the character "5", and of example 2.4 - the characters «23».

Partitioning into strings is performed using the function endline().

Examples of numerical expressions:

  • (1.1) [variable_number_1] + 1

  • (1.2) 2 ^ [variable_number_2] * ( Log10 ( [variable_number_3] ) + 2 )

  • (1.3) sin ( len ( [variable_string_1] ) )

Examples of string expressions:

  • (2.1) [variable_string_1] + [variable_string_2]

  • (2.2) "Piece of text" + [variable_line_1]

  • (2.3) 2 + 3 + [variable_string_1]

  • (2.4) "2" + "3" + [variable_string_1]

  • (2.5) SubStr ( [variable_string], 1, Length ( [variable_string] ) - 1 )

  • (2.6) If ( num([a]) > 5, "more," "less")

Operations

Table 1. Operations on arguments
Function Value type Description

+

num | str

If the arguments can be cast to numbers, the result is the sum of two numbers. Otherwise the arguments they are cast to a string and concatenated.

++

str

Brings the arguments to a string and concatenates them.

-

num

If the arguments can be converted to numbers, the result is their difference. Otherwise, the operation terminates with an error.

*

num

If the arguments can be converted to numbers, the result is their product. Otherwise, the operation terminates with an error.

/

num

If the arguments can be converted to numbers, the result is their quotient. Otherwise, the operation terminates with an error.

div

int

If the arguments can be converted to integers, the result is the integer part of their quotient. Otherwise, the operation terminates with an error.

rem

int

If the arguments can be converted to integers, the result is the remainder of the division. Otherwise, the operation terminates with an error.

==

bool

Casts argument values to the same type and compares them. Equality.

/=

bool

Casts argument values to the same type and compares them. Inequality.

>

bool

Casts argument values to the same type and compares them. More.

>=

bool

Casts argument values to the same type and compares them. Greater than or equal to.

<

bool

Casts argument values to the same type and compares them. Less.

=<

bool

Casts argument values to the same type and compares them. Less than or equal to.

Templates

The script editor application allows you to specify expressions using templates.

A template is a string that includes computable expressions in curly braces. In this case, switching between the tabs of template and expression setting performs automatic mutual conversion.

Example of an expression
"abc." + str([var]) + ".def" + endline() + replace([var],";",".") + substring([var2],3,5) + "zzz"
Example template
abc.{str([var])}.def
{replace([var1],";",".") + substring([var2],3,5)}zzz