Record.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 :=   Record.GetPosition([UseNames: Boolean])

Parameters

Record
 Type: Record
An instance of the Record 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

Example

The following example uses the GetPosition method to retrieve the primary key of the current record (MyRecord) from the Customer table. The primary key is stored in the varPrimaryKey variable and displayed in a message box. 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
    MyRecord: Record Customer;
    varPrimaryKey: Text;
    Text000: Label 'The primary key is: %1.';
begin    
    varPrimaryKey := MyRecord.GetPosition(true);  
    Message(Text000, varPrimaryKey);  
end;

Record Data Type
Get Started with AL
Developing Extensions