Each Library may include any number of scripts — pieces of automated code that is going to be executed on a certain event. Using scripts, you can add complex calculations, add, update or edit the entries, change the data as it is needed.
There are two types of scripts available in Memento Database: Triggers and Actions. The main difference between them is the activator: when the script is executed. For Triggers, you need to define an event which will launch the script like Editing or Updating an entry, Opening the Library, etc. Actions are activated by clicking the relevant icon on the toolbar of the Library. The more Actions you add, the more icons will be shown for a Library user.
To add or review the previously created scripts, open the Library, tap the burger icon at the top-right corner of the window and choose Scripts option. Here you will be able to add a new trigger or action using icon or adjust the Permissions for scripts by clicking the relevant icon at the top-right corner of the window:
- Libraries toggle and Available libraries list allow you to choose to the tables the scripts will have access to
- Read files option allows you to set whether the scripts will be able to read from files
- Write files option allows you to set whether the scripts will be able to modify external files
- Network option allows you to set whether the scripts will be able to execute HTTP requests
Memento Database uses JavaScript for writing scripts. A number of special functions and objects are provided specifically for working with Libraries and Entries. You can find detailed information and examples here: https://scripts.mementodatabase.com/