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

 Property Boolean Should_Save

Read Access: Get Should_Save to BooleanVariable



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

By evaluating Should_Save and HasRecord you can determine the major states of any DDO:

Should_Save=TrueA changed record exists. A save will edit the existing record.A new changed record. A save will create a new record.
Should_Save=FalseAn 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

    Forward Send Request_Save

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