Skip to content

Finding without Updating the DDO

DDOs support several find messages that allow you to find a record without disturbing the state of the current DDO. This allows you to take advantage of a DDO’s current constraints without having to actually update your DDO and its attached DEOs. These messages are useful if you need to check the status of some other record, but you do not wish to disturb the contents of the current record in a DDO.

These messages are referred to as “Read” messages to distinguish them from the more normal “Find” messages, which do update the DDOs. The “Read” messages are listed below with their corresponding “Find” messages. The parameters used by the “Read” and “Find” messages are the same:

Message is A non-DDO Updating version of
Request_Read Request_Find
ReadByRowId FindByRowId
Read_By_Recnum Find_By_Recnum

Because the Read messages do not update the DDO, you should always use the File Buffers to evaluate their values.

// Count number of users without changing the current User in the DDO
Function CountUsers returns integer
    Handle  hoDD
    Boolean bOK
    Integer iCount

    Move oUser_DD to hoDD
    Send Request_Read of hoDD FIRST_RECORD Users.File_Number 1
    Move (Found) to bOK

    While (bOK)
        Increment iCount
        Send Request_Read of hoDD GT Users.File_Number 1
        Move (Found) to bOK
    Loop

    Function_Return iCount
End_function

See Also