There are three basic kinds of node:
- interaction nodes (e.g. questions)
- action nodes (e.g. variable updates)
- section nodes.
Simple Rule: nodes are visited sequentially
By default, the nodes in a process are executed sequentially, one after the other.
What does it mean for a node to be executed?
This depends on the type of the node:
- To execute an interaction node = display the question / text
- To execute an action node = to do the action it defines (N.B. please however read about database actions below)
- To execute a section node = to enter the section, so that the next node visited will be the first node contained within the section
When the Simple Rule is modified
There are some aspects of Logiak Processes which complicate a little this extremely simple concept of linear step by step node execution.
1. The use of Preconditions to make execution conditional
Firstly, any node can have a Condition assigned as its Precondition and having a Precondition means that when the node is visited, it is not immediately executed. First, the condition is evaluated and the node is only executed if the condition evaluates to true.
In the case of a Section node, if a Section has a Precondition which evaluates to false, the whole Section and its contents will be skipped.
2. Object Actions are scheduled and executed at Process completion
The second modification of the. sequential execution concerns "Object" actions.
These "Object" Actions, such as "Create Object" represent database updates and can appear anywhere within a Process.
But it is important to note that when these actions are executed, the database is not actually updated at that point.
All object actions are essentially the scheduling of database updates.
All database updates are done together, in a database transaction, at the completion of the Process.
3. Values have default values from the outset
Nodes in a Process have values and these values have types. Values can be
- SYMBOL SET
- OBJECT INSTANCE
For each of these types there is a default value.
- TEXT = ""
- NUMBER = 0
- TRUE/FALSE = false
- DATE = 1 Jan 1970
- SYMBOL = novalue
- SYMBOL SET = empty set
- OBJECT INSTANCE = no value
- IMAGE = ""
All values in a Process are regarded as having their corresponding default values from the outset.
So a variable can in fact be referenced in advance of the "Create variable" action which creates it, but the only value it will yield is the default value for its type.
4. Calling a sub-process
Logiak permits one Process to call another.
When this happens, execution of the calling Process is paused while the sub-process executes. When the sub-process completes, the main Process resumes execution where it left off.
5. Jumping to a node
There is a Jump action which, if executed, simply takes control directly to the node specified. The step-by-step execution resumes from that point