Should_Save - BaseData_Set
Can be used to determine if a DataDictionary Object (DDO) has changed
Type: Property
Access: Read-Only
Data Type: Boolean
Parameters: None
Syntax
Property Boolean Should_Save
| Access Type | Syntax |
|---|---|
| Read Access: | Get Should_Save to BooleanVariable |
Description
Syntax
Get Should_Save of hoDDO to bChanged
Should_Save can be used to determine if a DataDictionary Object (DDO) has changed. If Should_Save is True, the DDO structure has changed and a save may be needed. Should_Save checks the changed state of a DDO and its parent DDOs. It also checks to see if a parent record has been switched.
There is no set variant of this message. Should_Save is set indirectly through data-input or by other messages such as Set File_Field_Changed_Value, Find, Clear, Request_Save, etc.
Get Should_Save of hoDDO to bChanged
If bChanged Begin
Get Request_Validate of hoDDO to bError
If (not(bError)) Begin
Send Request_Save of hoDDO
End
End
By evaluating Should_Save and HasRecord you can determine the major states of any DDO:
| HasRecord=True | HasRecord=False | |
|---|---|---|
| Should_Save=True | A changed record exists. A save will edit the existing record.A new changed record. A save will create a new record. | |
| Should_Save=False | An unchanged record exists. A save is not needed.A new unchanged record. A save is not needed. |
Changes in Related Parents
In the Order entry sample workspace, table Invt (inventory items) relates to table Vendor. Specifically, Invt.Vendor_Id relates to Vendor.Id. If an inventory item record is changed to relate it to a different Vendor record, Should_Save of the DataDictionary Object for the Invt table will return True.
In order to determine whether a related parent record has changed, Should_Save can be checked to see if any change was made to the table. If so, prior to the save actually taking place, for example, in Request_Save prior to the 'Forward Send' statement, the values of the related child and parent columns can be compared. If they are no longer the same, the parent has changed:
Procedure Request_Save
Integer iInvtVendorId iVendorId
Get Field_Current_Value of Invt_DD Field Invt.Vendor_ID to iInvtVendorId
Get Field_Current_Value of Vendor_DD Field Vendor.ID to iVendorId
If (iInvtVendorId <> iVendorId) Begin
// we know the parent record has changed, so now do whatever is needed in this condition here
End
Forward Send Request_Save
End_Procedure
| Col 1 | Col 2 |
|---|---|
| Note: | Should_Save is understood directly by all UI objects and this means that Should_Save should never be used with delegation; Should_Save should be sent directly to the data entry object (DEO) or the DataDictionary Object (DDO). |
See Also