Which block of code is responsible for the action?
Actions are controlled by action codes. It is not possible to perform an action from the code that calculates field values.
In addition to the special section of codes, you need to use functions that perform actions, for example, set — a function that changes the value in a field.
What does the system track that may be a condition for an action?
Totum tracks several triggers that can serve as a signal to initiate an action:
change in field value
row addition
row deletion
double-click in a locked field
Will the action code be executed if all triggers are disabled?
No, the activity of at least one trigger is mandatory.
Action codes are highlighted in the field header with an asterisk
— if the asterisk is empty
, it means there are no active triggers.
At what moment are the action codes executed?
Action codes are executed after the codes. First, all values of the modifiable strings are calculated, and then triggers are activated and actions are performed.
In what order are the action codes executed?
In the same way as codes are calculated. In the same order of placements and sort
within the placement.
Header
— Body part
— Footer
Rows in ascending order of id
or n
, and within in ascending order of sort
.
In the case of column-by-column recalculation, then column-by-column in ascending order of id
or n
.
What is the difference between set and setList?
set changes a single value, even if multiple rows match the conditions.
setList changes all values that match the conditions.
In Totum, all action functions that change values are divided into single and multiple variants.
Can I set a value for just one field or several at once?
set allows you to specify several fields to be changed in one row in a single action:
=: set(table: 'table'; field: 'field_1' = "value_1"; field: 'field_2' = "value_2"; where: 'condition_field' = #condition)
Can action functions be run from codes or formatting codes?
No — they cannot. Action functions perform an action only from the action code.
Does the action code cause the table in which the action is performed to be recalculated?
Yes.
For simple tables — this is the recalculation of the modified rows and the header.
For calculated and temporary — the entire table.
When you set to the calculated table will the whole table be recalculated or only the row in which the change is made?
The entire table.
What happens if the field to be modified also has an action code?
If a trigger on change is enabled there, the trigger will activate and the action code for that field will execute.
If more than one row is changed in the table, will the action code be executed on each row separately or will one common action be executed?
The action code will run on every modified row. Sometimes this leads to a significant overhead.
This is especially important for tables that are recalculated entirely - there is a trick for them:
For example, we need to recalculate a table based on changes in several fields, but do this only once:
=: selectList(table: $#ntn; field: 'field'; order: 'field' asc)
//Using order is important!
=: recalculate(table: 'table_to_recalc')
Totum will automatically track the composition of the field, and when it changes due to the modification of one or more tracked values, it will execute the action code once.
For simple tables, there is a similar trick — but more on that later.