Buttons
Ninox scripts triggered by buttons (or when a formula field is clicked) run in the context of the client and not as a transaction. This means that Ninox executes command by command separately, as if the user had made these entries.
This has the following consequences:
- The execution time can be long if many commands are executed, as the client and server must constantly exchange data with each other.
- The script can be aborted in the middle, for example by closing the browser window.
- During script execution, data changes from other users can also occur.
To optimise this, all commands in a transaction can be bracketed with do as transaction
. Execution then takes place in a single transaction on the server (web version) or in the client database (native apps). With do as server
, a similar effect is achieved, but the server-side execution is also forced in the native apps.
As a rule, scripts run considerably faster within do as server
. In return, however, the restrictions in the section transactions must be considered.
Triggers (e.g. when changing data) are automatically executed within the changing transaction - analogous to
do as transaction.