RecordRef.SetView(Text) Method

Version: Available or changed with runtime version 1.0.

Sets the current sort order, key, and filters on a table.


 RecordRef.SetView(String: Text)


 Type: RecordRef
An instance of the RecordRef data type.

 Type: Text
A string that contains the sort order, key, and filter to set. The string format is the same as the SourceTableView property on pages.


The value of the String parameter can be returned by the GetView Method (RecordRef) with the UseNames parameter explicitly set to false.

If the SetView method is executed with an empty string, all the filters are removed and the primary key is used.

If no table is selected, the SetView method fails.

This method works the same as the SetView Method (Record).


The following example opens the Customer (18) table as a RecordRef variable that is named CustomerRecRef. The SetView method sets the sort key to the Name field, sort order to Ascending and sets a filter that selects records between 1000 and 2000. The GetView Method (RecordRef) retrieves the sort order, key and filters that have been set and stores the value in the ViewString variable. The value in the ViewString variable is displayed in a message box.

    CustomerRecRef: RecordRef;
    ViewString: Text;
    Text000: Label 'The following is the current sort order, key, and filters that are set: %1';
    CustomerRecRef.SetView('Sorting(Name) Order(Ascending) Where(No.=Const(10000..20000))');  
    ViewString := CustomerRecRef.GetView;  
    Message(Text000, ViewString);  

See Also

RecordRef Data Type
Get Started with AL
Developing Extensions