Part of the Data Dictionaries class creation process is the defining of custom behaviors in events. These events allow you to customize the main Data Dictionary processes. Those processes are: Find, Clear, Save, and Delete.
Events are provided to allow you to control the following:
You can perform validations and error checking during a save or a delete. If an error is generated the save or delete is canceled and any changes are rolled back.
You can use events to maintain balances between related tables during saves and deletes.
You can use events to define and control handle special relationships between tables.
You can use events to perform special processing when new records are found. This includes setting default values for new records.
You can use events to perform special save or delete processing.
A single event may be used by multiple operations. For example, the Backout event is called during a save and a delete. The Relate_Main_File event may be called by saves, deletes, finds and clears.
Some events are always called in a locked state (e.g. Update and Backout) while other events may be called in an unlocked state (e.g. Relate_Main_File).
The predefined Data Dictionary events are:
You should always forward event messages.
Although some of the Data Dictionary events perform no default action other events perform very important tasks and must be forwarded. Unless you specifically want to cancel a behavior, you are advised to always forward your event augmentations. This creates code that is robust – it will work the first time and it will continue to work as changes are made to your underlying classes. So, while we could code an event as follows:
// incorrect
Procedure Update
Move (Customer.due + order.total) to Customer.due
End_Procedure
We will instead code this with a forward send:
// correct
Procedure Update
Forward send Update
Move (Customer.due + order.total) to Customer.due
End_Procedure
Data Dictionaries allow you to define events that should be called when a field is validated and when windows data-entry objects bound to a particular field are entered or exited. These events are tied to fields using the Field_Validate_msg, Field_Entry_msg and Field_Exit_msg and are discussed in there own sections. In particular, the field validation events can be particularly useful.
Defining Data Dictionary Classes