Executable tables

Executable tables implement logic in rows: a succession of actions that will be executed sequentially.

For example:

Once executed, those variables will have the following values:

x = 100
y = 200
z = 300

A table is considered an executable table if it has at least one column defined as output. Output columns are marked in dark grey. In order to turn a column into an output column, simply right click on its header, and select Change to output.

Once done, the column color will change:

By default new tables are data tables. Remember to change the output columns to turn it into an executable table.

Executable tables can combine input columns with output columns, being the input ones, conditions that have to be met to execute the output cells. For example, the following executable table:

Will generate the following output:

x = 100
y = 200
msg = 'y is greater than x'

We can see that the A column is an input column, so its cells are first evaluated to decide whether to execute the B column or ignore it.

We can have multiple input and output columns:

In this case, the msg variable will be:

msg = 'You are of legal age and live in the US'

We can simplify the table this way:

We can use header names as implicit variables and we can combine multiple commands both in input and output cells splitting them by semicolons as it is explained in the next section.

Multiple input conditions

Multiple variables can be combined to form complex boolean expressions. For example:

Will generate the following output:

msg = "Visit a doctor"

Multivalue cells

Sometimes, it is easier to combine multiple cell values in the same cell. In order to achieve this, simply edit the cell and separate the different values by semicolons:

Stop on match

All rows in an execution table will be executed unless the Stop on match checkbox is enabled:

If enabled, the execution will be break when the first matching row is executed, so the rest of rows will be ignored. For example:

Will generate the following output if Stop on match is enabled:

msg1 = 'You are of legal age'

Note that, although row 3 also matches, it is not executed. Also note that Stop on match does not apply in rows where there are no input conditions defined, as row 1.

Assigning values to the column

We can assign any result to the variable defined in the column header. For example:

When this cell is executed, the value SKU-123 will be assigned to the variable skus.

See the Cell types section to know more about cell types and some gotchas to avoid.

Another example:

In this case, the output will be:

result = 12

If we want to add values to a list, we can use the short-hand + symbol, separating the values by semicolons:

In this case, the output will be:

skus: ["SKU-123", "SKU-124", "SKU-222"]

Note that here we are not enclosing the skus in simple quotes as the + short-hand interprets what we want to do.

Functions

An executable table can also execute functions. For example, the simplest function is possibly the LOG function that will print a text in the console:

We can also do operations with functions, for example:

In this case, the output will be:

name: "John"

Pipes

In more complex logics, it is usual to pass the output of a function as input of another function. We can achieve this using pipes. For example, this logic doesn't use pipes:

The output is:

name: "John Gray"

We can simplify this logic with pipes getting the same result:

We can see that with pipes, the first parameter of a function is implicit and will be filled with the output of the previous element of the pipe.

Executing other tables

Any executable table can be called from any other executable table through its table key. Once an executable table is defined, a new function is created from its defined key.

For example, let's create a new function named MYSUM that simply takes 2 numbers as parameters, adds them, and return the result:

We see that the parameters are referred from within this table as @1 and @2. We can use up to 5 parameters.

The result to return has to be stored in an internal variable named return.

Now, we could use this new function this way:

If we execute this, the result will be:

sum = 30

The scope where variables are stored is shared, so if we modify a variable from within a function, the variable will remain modified for any other table that uses it.

Comments

Any cell that starts with the # symbol will be considered a comment. For example:

Last updated