Save Operations with Data Entry Objects
When Data Entry Objects (DEOs) are connected to a Data Dictionary Object (DDO), the entire save process is automatic and controlled by the user. The user will enter data, find records, and then perform some action (button click, keystroke, etc.) to request the save. When this occurs, a message is sent to the data-entry, usually Request_Save, to start the save. The DEO does all of the work for you:
- Checks if a save is needed
- Asks its DDO to validate all fields (Request_Validate)
- Verifies with the user that they want to perform the save
- Asks its DDO to perform the save (Request_Save)
- Updates DEOs with new saved changes
- Optionally, clears the DEOs
Below is an example of a simplified DEO Request_Save procedure. These are the types of methods and functionality built directly into DEOs.
// The DEO save process
procedure Request_Save
Handle hoDDO
Boolean bError bClear bChanged
Get Server to hoDDO
Get Should_Save of hoDDO to bChanged
If (not(bChanged)) Procedure_Return // nothing to save
Get Request_Validate of hoDDO to bError
If (bError) Procedure_Return // field validation error, can't save
Get Verify_Save to bError // ask user to verify save
If (bError) Procedure_Return // user decided to not save
Send Request_Save of hoDDO
Move (Err) to bError // Err set if save failed
If (not(bError)) begin
Get Auto_Clear_DEO_State to bClear // clear after save?
If bClear send Request_Clear // ask DEO to clear
End
End_Procedure