Record.Ascending([Boolean]) Method

Version: Available or changed with runtime version 1.0.

Gets or sets the order in which the system searches through a table.

Syntax

[Ascending := ]  Record.Ascending([Ascending: Boolean])

Note

This method can be invoked using property access syntax.

Parameters

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

[Optional] Ascending
 Type: Boolean

Return Value

[Optional] Ascending
 Type: Boolean

Example 1

The following example returns a value that indicates the current search order of the Customer table, to which MyRecord record belongs. The return value is stored in the IsAscending variable and displayed in a message box. In this example, the value Yes is displayed in the message box, which means that the search order is ascending. This is because the SetAscending parameter is not used.

codeunit 50111 IsAscending
{
    trigger OnRun()
    var
        MyRecord: Record Customer;
        IsAscending: Boolean;
        Text000: Text;

    begin
        IsAscending := MyRecord.Ascending;
        Message(Text000, IsAscending);
    end;
}

Example 2

The following example sets the current sort order to descending by setting the SetAscending parameter to false. The value displayed in the message box is No.

codeunit 50111 IsAscending
{
    trigger OnRun()
    var
        MyRecord: Record Customer;
        IsAscending: Boolean;
        Text000: Text;

    begin
        IsAscending := MyRecord.Ascending(false);
        Message(Text000, IsAscending);
    end;
}

Record Data Type
Get Started with AL
Developing Extensions