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 macrossc_commit_trans and sc_rollback.
Now, the macro sc_commit_trans is loaded that once the control process has been carried out, it can be by means of a condition, it confirms the transaction, that is, if all the proposed conditions are fulfilled, it confirms the transaction, it can be that of inserting, modify or delete a record.
Otherwise it is the macro sc_rollback_trans that 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.
Then, in the following example, it is responsible for making a control when registering:
1. Within the AfterInsert event a control is made after entering:
2. When executing, we enter a code other than 85:
Depending on the condition, if the entered code is not 85, then confirm the transaction with the macro sc_commit_trans.
3. Otherwise, we enter a record with code 85:
4. Then within our database administrator you can see that the record was not loaded with code 85, that's thanks to the macro sc_rollback_trans: