Read trigger
Read triggers are automatisms that are activated when one or more specific fields are modified. Their job is to retrieve a value from the database and to write it inside a field of the data form or inside an additional table.
For example, after selecting the customer on an invoice, every time I insert an article within the rows, a trigger will be prompted that will crosscheck the customer and the article code to extrapolate the price reserved for him/her.
To create a read trigger, click on Settings and press the Add button.
In the left-hand column select which fields will set off the trigger: in this case they are the fields of the invoice table and the name and VAT number have been selected.
The command row has been inserted in the SQL String column to select from the database all the data from the Items Prices table that have the same name as on the invoice.
When the SQL command is executed, the part of text [name] will be automatically replaced with the actual value present at that moment.
If the reading trigger is on the grid of rows on the invoice, and therefore is triggered at each insertion of the article, to recover the customer present in the data form it will be necessary to replace the square brackets with braces in this way: {name}. The program will retrieve this info not within the grid but from the data form that contains it.
To write the values retrieved from the trigger, you will need to set the links. If the SQL string is not filled in, the program will allow you to create the links using the fields of the current data form.
The triggers can be set up in such a way that they only activate if precise conditions are present within the data form.
In this case the trigger is set to go off only if the value of the common field is equal to "modena".