Muokkaa

Jaa


RecordRef.GetPosition([Boolean]) Method

Version: Available or changed with runtime version 1.0.

Gets a string that contains the primary key of the current record.

Syntax

String :=   RecordRef.GetPosition([UseNames: Boolean])

Parameters

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

[Optional] UseNames
 Type: Boolean
Indicates whether a reference to the field caption or the field number should be returned. If set to true (default value) or empty, then the returned string contains references to field captions in the table with which the record is associated. If a field doesn't have a caption, then the name is returned. If the parameter is set to false, then field numbers are used instead.

Return Value

String
 Type: Text
The name or number of the field that contains the primary key.

Remarks

This method works just like the GetPosition Method (Record).

Example

The following example opens the Customer table as a RecordRef that is named RecRef. The RecordRef variable uses the GetPosition method to retrieve the position of the primary key. The UseNames parameter is set to true so the caption of the field that contains the primary key is returned. If you set UseNames to false, the number of the field is returned.

var
    RecRef: RecordRef;
    varPrimaryKey: Text;
    Text000: Label 'The primary key is: %1.';
begin    
    RecRef.Open(Database::Customer);  
    varPrimaryKey := RecRef.GetPosition(True);  
    Message(Text000, varPrimaryKey);  
end;

RecordRef Data Type
Get Started with AL
Developing Extensions