Guide
Variables, loops and conditions
What one instruction reads, the next one uses. This is what makes a workflow work with next month's data.
A workflow that only writes fixed text produces the same document every time. What makes it worth saving is that it reads the data and builds the document from it, so next month you change the data and press Run.
Saving a value and using it: @name
Many instructions offer a Save… in field. Type a name there and the instruction stores its result (a count, a piece of text, a list of rows) under that name.
In any text field, type @ followed by that name and it is replaced by the value.
@customerName inserts whatever was saved under customerName. To write a text that really starts
with an at sign, double it: @@team produces @team.
Numeric and yes/no fields cannot take an @name, so each one has a companion from variable field.
Leave it empty to use the value you typed; fill it in with a saved name to use that value instead.
One field of a record: @name.field
When what was saved is a whole record (the usual case inside a loop over rows), add a dot and the
name of the field: @line.price writes the price of that line. It goes as deep as you need
(@invoice.lines.1.price), and a number is a position counting from 1.
If the field name is not one the record has, the run says so and lists the fields it does have. This is what catches the usual breakage of a monthly workflow: the export renames a column and everything that read it would otherwise go blank in silence.
Repeating for each item: For Each
A For Each runs a block of instructions once for each item in a saved list. Its fields:
| Field | What it is |
|---|---|
| Array key | The saved list to go through. |
| Item key | The name the current item takes inside the block. Required. |
| Index key | Optional: the turn number, 1 for the first item. |
| Save count key | Optional: the total number of turns, saved when the loop ends. |
Inside the block the current item is read with @, like any other value. When the name you give it
holds neither a list nor a group (a single value, or a name nobody saved), the loop says so instead
of quietly running zero times.
Deciding based on a value: If
An If runs a block only when a condition is met: equal, different, greater than, less than, or whether one value contains the other. An optional second block runs when it is not met.
Three things worth knowing:
- Numbers use a decimal point:
4.5, not4,5. A number written with a comma is not read as a number. - Comparisons tell upper from lower case:
Totalandtotalare different values. - Greater than and less than only make sense between numbers. If either side is not one, neither block runs.
Loops and conditions can be nested inside one another.
Calculating
The calculation instructions work in base ten, so 0.1 + 0.2 gives 0.3. They round, aggregate a
list (sum, average, minimum, maximum, count), group it, and format the result as text ($1,234.56,
1.234,56 €). Formatting goes last: once a number is formatted it is text.
See it in a real workflow
The monthly account statement example uses all of this: a group and aggregate, a loop over customers, a number format and a condition. It is short enough to read whole. The monthly close example does the same at full size: loops that make a slide per region and a table row per line, and settings kept in variables at the top.