A Function has input parameters that can be used in its body and outputs that can be defined in its body.
A function doesn't start until all its input parameters are resolved (have a value) and is executed again one of its input has a new value (until the context of creation of the function is destroyed, e.g. the user goes to another screen).
An Action represents a specific function which is executed when an event occurred.
In opposition to Functions, an action is called immediately when the Control Flow from which it depends is triggered. The action doesn't wait for the other inputs to be resolved (if any).
Even if Functions and Actions are very close, they have each some particularities:
|Usage examples||Compute text of button, compute position of UI component, compute math operation, ...||Create an object in a database, execute a query, send an email, perform some authentication, ...|
|Executed when||All inputs are resolved (i.e. all inputs have a value), and when an input changes||The Control Flow input receives a new "pulse"|
|Order of execution is guaranteed||No||Yes|
|Can call other functions||Yes||Yes|
|Can call other actions||Yes||Yes|
Create/Update/Delete an Anonymous Function
Functions can be created in the Properties panel using the f(x). In some cases, f(x) button is in a dropdown menu.
ƒ(x) provides possibility to set dynamically the value of a property using a function.
Screen and Visual Component properties can be used directly in the function.
The result of the function will be assigned to the property to be computed.
Upon selecting a function from the Property panel of a component, the sub-editor allows the user to to edit a Function or an Action for a specific UI component. The user can add calls to other functions and link them together in order to define the function's body. Function inputs and outputs can be linked to function calls as inputs respectively outputs.
The property picker is used to read/write properties or dispatch an event within a function.
Reusable Functions & Actions
One can create any number of reusable Functions and Actions within a project.
The user creates Inputs and Outputs that can be added to the Function/Action by drag-and-dropping from the Function editor.
Actions automatically come with Control Flow Inputs and Outputs.