Skip to main content
This guide explains how to register update-where procedures to a store in the Atoti Datastore. For information about the different types of update-where procedures, see the Register update where procedures documentation.

Context

Let’s define a datastore made of 2 stores joined together. One sales store:
One product store:

Register an insertion-time update-where procedure

Let’s start by registering an insertion-time trigger on the sales store which updates the inserted rows where the product is “Product1” to double the Amount. For insertion-time triggers it is only possible to select fields in the updated table.
Note that the procedure will only take effect in the next transaction
Let’s now insert some data into the sales store, this will trigger the procedure we just registered:
The content of the store has been doubled for Product1:

Register a commit-time update-where procedure

Let’s now register a commit-time trigger on the sales store which update the “Is Meaningful” field to true for all the rows where the Amount multiplied by the Unit Price is greater than 1000. In order to do that, we need the value from 2 different stores at the same time, which is not possible with insertion-time triggers.
Note that the procedure will take effect immediately in the current transaction.
If we insert rows in both stores, the procedure will be triggered and the “Is Meaningful” field will be updated:
And even if we only update the content of the target store the procedure will be triggered as well:
The Product2 line of the Sales store has been updated, even if the update is on the Products store: