OnNewCurrentRecord - DataDictionary

Notification event that is sent every time the DDO's record is switched

Type: Event

Parameters: RowId riOldRowId RowId riNewRowId

ParameterDescription
riOldRowIdthe RowId record identity of the old record
riNewRowIdthe RowId record identity of the new record


Syntax
Procedure OnNewCurrentRecord RowId riOldRowId RowId riNewRowId

Description

OnNewCurrentRecord can be thought of as a post-find/clear/save/delete event since it gets called after every record find, clear, save and delete. It is called whenever CurrentRowId changes.

OnNewCurrentRecord is passed two RowId parameters: the old record RowId and the new record RowId. By looking at these two parameters, you can tell if the DDO has found a record or if it is creating a new one (if the new RowId is null).

You cannot use this procedure to change the Current RowId. This message is sent to notify of a change that is going to happen. You cannot abort the change.

OnNewCurrentRecord is sent when the current record is changing, with two exceptions. If a DDO becomes in-use and the record being established is null, OnNewCurrentRecord will be called (old record =null new record =null). After a save, OnNewCurrentRecord is called for all DDOs that participated in the save, even if the record did not change. If you need to test for this condition, you could check Operation_Mode and see if it is Mode_Saving.

Procedure OnNewCurrentRecord RowId riOldRowId RowId riNewRowId
    Forward Send OnNewCurrentRecord riOldRowId riNewRowId

    // Assume we want to trap saves of existing records.
    If (Operation_Mode = Mode_Saving AND ;
        IsSameRowId(riOldRowId,riNewRowId) ) Begin
        :
    End
    Else ...
End_Procedure


Special Notes


See Also

When to Use the File-Buffer | Defining Data Dictionary Events | HasRecord | CurrentRowId