Skip to content

When to Use the DDO-Field-Buffer

Get Field_Current_Value of hoDD Field Customer.Name to sName
Set Field_Changed_Value of hoDD Field Customer.Name to sName

You should use the DDO-Field-Buffer value under the following conditions:

  1. Changing a Field Value Before Saving

Any time you are changing a field value in anticipation of saving this change, you must use the DDO-Field-Buffer value. Normally, you will use Set Field_Changed_Value to do this. If you move your changes directly to the File Buffer, they will be overwritten by the values in the DDO-Field-Buffer.

Function NewOrder Integer iCustNo String sTerms ;
    String sShipVia Returns Boolean
    Boolean bErr
    Handle  hoOrderDD hoCustDD
    Move OrderHea_DD to hoOrderDD
    Move Customer_DD to hoCustDD
    Send Clear of hoOrderDD
    Move iCustNo to Customer.Customer_Number
    Send Find of hoCustDD EQ 1
    Set Field_Changed_Value of hoOrderDD Field OrderHea.Terms to sTerms
    Set Field_Changed_Value of hoOrderDD Field Orderhea.Ship to sShip
    Get Request_Validate of hoOrderDD to bErr
    If not bErr Begin
        Send Request_Save of hoOrderDD
        Move (Err) to bErr
    End
    Function_Return bErr
End_Function
  1. Custom Field Validation

If you create custom field validation, exit, or entry methods in your Data Dictionary class or your object, you should use the DDO-Field-Buffer (File_Field_Current_Value) to retrieve a field’s current value. You can use the File Buffer to return the field’s original, unchanged value. Note that the validation field’s current value is passed into field validation functions. You would only need to retrieve some DDO Field value other than the field you are currently validating.

// Method in Data Dictionary Class
Set Field_Entry_msg Field Orderdtl.Price To Entering_Price
:
Procedure Entering_Price Integer iField Number nAmnt
    If (nAmnt = 0) Begin
        Get File_Field_Current_Value File_Field Invt.Unit_Price To nAmnt
        Set Field_Changed_Value iField To nAmnt
    End
End_Procedure
  1. Retrieving a DDO’s Current Field Value

If you need to retrieve a DDO’s current field value, you must use the DDO-Field-Buffer (File_Field_Current_Value).

// Method in Data Entry Object
Procedure RefreshTotal
    Integer iQty
    Number  nAmnt
    Handle hoOrderDtl
    Move oOrderDtl_DD to hoOrderDtl
    Get Field_Current_Value of hoOrderDtl Field Orderdtl.Qty To iQty
    Get Field_Current_Value of hoOrderDtl Field Orderdtl.Price To nAmnt
    Set Value to (nAmnt * iQty)
End_Procedure

Note

If you need to retrieve the original, unchanged value of the field, you must use the File Buffer. If the field value is unchanged (as is always the case in reports), you can use either the File Buffer or the DDO Field Buffer. This is discussed in the next section.

See Also

Understanding File Buffers and DDO Field Buffers