Record.SetCurrentKey(Any [, Any,...]) Method

Version: Available or changed with runtime version 1.0.

Selects a key for a table.

Syntax

[Ok := ]  Record.SetCurrentKey(Field1: Any [, Field2: Any,...])

Parameters

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

Field1
 Type: Any

[Optional] Field2
 Type: Any

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

You can use SetCurrentKey for selecting a key and sorting. When you use SetCurrentKey the following rules apply:

  • Inactive fields are ignored. Only active keys are scanned.

  • When searching for a key, the first occurrence of the specified fields is selected. This means the following:

    • If you specify only one field as a parameter when you call SetCurrentKey, the key that is actually selected may consist of more than one field.

    • If the field that you specify is the first component of several keys, the key that is selected may not be the key that you expect.

    • If no keys can be found that include the fields that you specify, the return value is false.

See Also

Record Data Type
Get Started with AL
Developing Extensions
SetCurrentKey, SetRange, SetFilter, GetRangeMin, and GetRangeMax Methods