Muokkaa

Jaa


RecordRef.Get(RecordId) Method

Version: Available or changed with runtime version 1.0.

Gets a record based on the ID of the record.

Syntax

[Ok := ]  RecordRef.Get(RecordID: RecordId)

Parameters

RecordRef
 Type: RecordRef
An instance of the RecordRef data type.

RecordID
 Type: RecordId
The RecordID that contains the table number and the primary key of the table and is used to identify the record that you want to get.

Return Value

[Optional] Ok
 Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.

Remarks

This method always uses the primary key for the table. It ignores any filters that are set, except security filters. Security filters are applied or ignored based on the Security Filter Mode. The current key and filters are not changed after you call this method. .

Example

The following example opens the Customer table with the RecordRef variable, RecRef. The code assigns the first field in the table, which is the No. field, to MyFieldRef variable. The variable is assigned a value of 30000 by using the Field Method (RecordRef). The RecordId Method (RecordRef) retrieves the record ID of the record that has a value of 30000 in the No. field. The Get method then uses the RecID variable then to retrieves the record.

var
    RecRef: RecordRef;
    MyFieldRef: FieldRef;
    RecID: RecordId;
begin     
    RecRef.Open(Database::Customer);  
    MyFieldRef := RecRef.Field(1);  
    MyFieldRef.Value := '30000';  
    if RecRef.Find('=') then begin  
      RecID := RecRef.RecordId;  
      RecRef.Get(RecID);  
    end;  
end;

RecordRef Data Type
Get Started with AL
Developing Extensions