Skip to main content
Version: 0.23.1

Values, Variables & Expressions

Almost every action has a field where you type a value — Notification messages, Create variable, conditions, loops, action parameters. Into that one field you can put plain text, insert variables, or have a value calculated. This page covers both the everyday cases and the advanced ones.

Two rules that get you most of the way

  1. What you type is text. No quotes needed — Good morning is simply the text Good morning.
  2. A variable is marked with $. Type $ and the auto-completer opens with the list of variables. Without $, the name is treated as an ordinary word.

The examples below assume these variables:

VariableValueType
$nameJan Nováktext
$amount1250.5number
$count3number
$invoice_no2024001number
$date01.02.2024text
$text' Invoice 2024 'text with spaces
$items['apples', 'pears', 'plums']list
$record{'id': 7, 'state': 'OK'}dictionary
$note''empty text

Everyday use

Text with variables

The most common case. Write a sentence and put $ wherever a value should be substituted. No quotes, no plus signs.

You typeResult
Record $name cannot be processedRecord Jan Novák cannot be processed
Good morning $name, thank you for your order.Good morning Jan Novák, thank you for your order.
Error (code $invoice_no): processing failed.Error (code 2024001): processing failed.

Full stops, commas, colons, brackets, dashes and percent signs are ordinary punctuation — type them freely. Spaces stay exactly as you write them, including after a variable.

Numbers in text

Numbers mix into text without restriction, whether typed directly or coming from a variable. Everything is converted to text automatically.

You typeResult
Invoice number $invoice_no has been paidInvoice number 2024001 has been paid
We have $count items for $amount CZK.We have 3 items for 1250.5 CZK.
note

In earlier versions this combination of text and a number ended with an error. It now works.

A single value keeps its type

When the field contains just one thing, you get exactly that — text stays text, a number stays a number, and a variable keeps its own type.

You typeResult
$nameJan Novák — the value with its type
approvedapproved — text
4242 — number
"42"42text, not a number

Put a digit in quotes when you need it as text. The quotes are preserved in the field.

Calculating

Numbers can be used in arithmetic. Leave spaces around the operator, or use brackets — that is how the Editor tells a calculation from text.

You typeResult
$amount * 1.211513.105
$invoice_no + 12024002
($amount + 100) / 2675.25
20240201-00120240201-001text, not subtraction
tip

Without spaces around the operator the value is taken as text, so document numbers and payment references stay intact.


The auto-completer

  • Type $ and the list of variables opens; pick one and the full name is inserted.
  • The word before $ is kept — typing Good morning and then $ does not overwrite it.
  • Want a space? Type it yourself: Good morning $name.
  • Tabs at the top hold more than variables: Variables, Operators, Constants, General, Math, Text and Date & Time. The selected item is inserted together with an example of its syntax.
  • Colour highlighting marks variables inside the field, so you can see at a glance what gets substituted and what is plain text.
  • The preview under the field shows the result. Green means fine; red means an error — most often a typo in a variable name.

Saving and reopening

The value is stored so that it always behaves the same way. Reopen the action and you see it back in readable form, not in a technical notation:

You typeAfter reopening
Record $name cannot be processedRecord $name cannot be processed

Older scenarios open correctly too. Even where a value was written the old way — with quotes and plus signs — it is displayed in the new readable form and behaves as before.

Common mistakes

You typeResultFix
namename — an ordinary word, not the valueThe $ is missing. Use $name.
Good morning$nameGood morningJan NovákSpace missing before $: Good morning $name.
$naamered preview — the variable does not existTypo. Pick the variable from the auto-completer.

Advanced expressions

The field also accepts calculations, text manipulation, date handling and conditions. The notation is Python; variables are still marked with $.

Reaching into data

When a variable holds a list or a dictionary, square brackets get you inside. After you type [, the auto-completer offers the keys or positions directly.

You typeResult
$items[0]apples — first element, counting from zero
$items[-1]plums — last element
$record['state']OK — value by key
$record['id']7
$name[0:3]Jan — first three characters

The same notation slices a list.

Working with text

Write a dot after the variable and the name of an operation:

You typeResult
$name.upper()JAN NOVÁK
$text.strip()Invoice 2024 — trims leading and trailing spaces
$name.replace('Novák', 'Nový')Jan Nový
$date.split('.')['01', '02', '2024']
", ".join($items)apples, pears, plums
$text.strip().lower()invoice 2024 — operations chain

Functions

The General and Math tabs of the auto-completer list what is available, each with a description and an example.

You typeResult
len($items)3 — number of elements
len($name)9 — number of characters
int($amount)1250
str($count)3 — as text
round($amount)1250.0
max($count, 10)10 — larger of the two; min likewise
sum([1, 2, 3])6
abs(-5)5

Lists, dictionaries and tuples

Useful when you need to pass several values at once — into a form, or on to another action.

You typeResult
[$name, $count]['Jan Novák', 3] — list
{id:$count, name:$name}{'id': 3, 'name': 'Jan Novák'} — dictionary
($count, $amount)(3, 1250.5) — tuple

Key names need no quotes. After reopening you see them quoted — {'id':$count, …} — which is the same thing.

warning

Mind the difference: $count, $amount with nothing else is a tuple, whereas We have $count for $amount CZK is text.

Date and time

A date stored as text must first be parsed with datetime_parse and then rendered with datetime_format.

You typeResult
datetime_parse($date, '%d.%m.%Y')the date read from the text
datetime_format(datetime_parse($date, '%d.%m.%Y'), '%Y-%m-%d')2024-02-01
datetime_format(datetime.datetime.now(), '%d.%m.%Y')today's date
datetime_format(datetime_add(datetime.datetime.now(), days=7), '%d.%m.%Y')the date a week from now
HelperWhat it takes
datetime_parse(text, format, tz=None)Reads a date out of text.
datetime_format(date, format)Renders a date as text.
datetime_add(date, …)Shifts a date by days, hours, minutes, seconds, microseconds, months or years.
datetime_set(date, …)Sets a specific part — day, month, year, hour, minute, second, microsecond.

Format codes: %d day, %m month, %Y four-digit year, %H hour, %M minute.

Constants and system values

The Constants tab holds ready-made values; picking one inserts the whole expression.

You typeResult
datetime.datetime.now()current date and time
int(datetime.datetime.now().timestamp())seconds since the epoch, e.g. 1785841813
random.randint(1, 100)a random number
$CONSTANTS['FULL_DATE']a scenario-wide constant — see the full list

Modules

Five modules are available: re, math, random, datetime and aiviro.

You typeResult
re.sub('[0-9]', '', $text)' Invoice ' — strips all digits
math.ceil($amount)1251 — rounds up
random.randint(1, 100)a random number from 1 to 100

Number bases

You typeResult
bin($count)0b11
hex($count)0x3
oct($count)0o3
int("1100", 2)12 — from binary text back to a number

Operators

Every operator below is also in the Operators tab of the auto-completer, with a description.

Arithmetic

You typeResultMeaning
$amount + $count1253.5add
$amount - $count1247.5subtract
$amount * $count3751.5multiply
$amount / $count416.833…divide — result is a decimal
$amount // $count416.0integer division
$amount % $count2.5remainder — handy for odd/even tests
$count ** 29power

Joining and repeating

+ and * work on text and lists too — there they join and repeat rather than add.

You typeResult
$items + ["berries"]['apples', 'pears', 'plums', 'berries']
"-" * 20-------------------- — a separator

You do not need + to build text from variables — just write the sentence and mark the variables with $.

Comparison

Used mostly in Condition and loop actions, where the Editor asks "should this run?". The answer is True or False.

You typeResultMeaning
$amount > 1000Truegreater than; < is less than
$count <= 3Trueless than or equal; >= likewise
$record['state'] == "OK"Trueequals — note the two equals signs
$name != "Petr"Truedoes not equal

Logic

You typeResultMeaning
$amount > 1000 and $count > 1Trueboth must hold
$amount > 5000 or $count > 1Trueat least one must hold
not $noteTruenegation — holds when the value is empty
$count > 1 and $count < 10Truea range

Empty text, zero and an empty list count as "no"; anything filled in counts as "yes".

Contains / is inside

You typeResult
"apples" in $itemsTrue
"bananas" not in $itemsTrue
"state" in $recordTrue — does the dictionary have that key?
"Novák" in $nameTrue — substring search in text
$note is NoneFalse — empty text is not the same as None

Two useful tricks

You typeResult
$note or "not filled in"not filled in — a fallback when the variable is empty
len($items) > 2True — a condition built on a function's result

One-line conditions

For a simple "if yes then A, otherwise B", write the condition straight into the field — typically in Create variable.

You typeResult
"VIP" if $amount > 1000 else "standard"VIP
$name if $name else "unknown customer"Jan Novák, or unknown customer if $name were empty

Transforming and filtering a list

One line can walk a list and change or filter each item.

You typeResult
[i.upper() for i in $items]['APPLES', 'PEARS', 'PLUMS']
[i for i in $items if i != 'pears']['apples', 'plums']
len([i for i in $items if i != 'pears'])2

i is just a helper name for one item — it takes no $.

F-strings

An f-string is text with values substituted in, what used to be written as f"text {variable}". You no longer need to write it: type the text and mark variables with $, and the Editor builds the f-string itself.

You typeResult
Record $name cannot be processedRecord Jan Novák cannot be processed
f"Hello {name}"Hello Jan Novák

Written by hand it works too. Inside the braces, though, no ${name} is right, {$name} is not. After reopening you see the simpler form, Hello $name.

Older scenarios containing f-strings keep working and open correctly.


When to reach for Python Code instead

The value field is meant for one value on one line. As soon as you need several steps in sequence, loops, error handling or longer logic, use the Python Code action — there you get a full editor and the code stays readable.