編集

次の方法で共有


KeyRef.Record() Method

Version: Available or changed with runtime version 1.0.

Returns a RecordRef for the current record referred to by the key.

Syntax

Record :=   KeyRef.Record()

Parameters

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

Return Value

Record
 Type: RecordRef
The RecordRef of the record that is currently selected referenced by the key. If a key is not selected, an error is returned.

The table with ID 18 (the Customer table) is open with a reference. The KeyRef Data Type for the record is retrieved by using the KeyIndex Method (RecordRef). The method retrieves the key that has an index of 1 in the record and stores the value in the varKeyRef variable. The varKeyRef variable is then used to return the RecordRef Data Type.

var
    RecRef: RecordRef;
    varKeyRef: KeyRef;
begin    
    RecRef.Open(18);  
    varKeyRef := RecRef.KeyIndex(1);  
    RecRef := varKeyRef.Record;  
end;

KeyRef Data Type
Get Started with AL
Developing Extensions