When we need to maintain a control or follow-up to a specific procedure at the time of entering, modify some procedure within the database within a form we have the macro sc_begin_trans.
The macro sc_begin_trans is responsible for carrying out a transaction control procedure within theScriptCase, but it can also be complemented with the sc_commit_trans and sc_rollback macros.
Now, the macro sc_commit_trans takes care that once the control process has been carried out, it can be by means of a condition, confirms the transaction, that is, if all the proposed conditions are fulfilled, confirms the transaction, it can be the to insert, modify or delete a record.
Otherwise the macro sc_rollback_transque is responsible for canceling the transactions given by the user, for example, when wanting to enter, modify or delete a record, this is responsible for canceling or omitting the procedure.
To show an alert message we will use a JavaScript function that is responsible for displaying the alert message.
Then, in the following example, it is responsible for making a control when registering:
1. Within the onAfterInsert event, it performs a control after entering by means of a condition:
2. The changes are saved, and when you save a record with the name Brazil, it does not allow you to store it.