RecordRef.ReadPermission() Method

Version: Available or changed with runtime version 1.0.

Determines if you can read from a table.

Syntax

Ok :=   RecordRef.ReadPermission()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

Ok
 Type: Boolean
true if you can read from some or all of the table; otherwise, false.

Remarks

This method can test for both full read permission and a partial read permission that has been granted with a security filter.

This method uses the filter that is currently applied to the RecordRef to determine whether you have read permission. If no filter is applied, the method tests for full read permission. If a filter has been set, the method only tests for read permission in the range of the filter.

To determine whether the user has a partial read permission because a security filter has been applied, view the Permissions page.

If you do not have permission to read from a table and you attempt to read, a run-time error occurs. This method lets you determine in advance if you have read permission. When the permissions are checked, the combination of the permissions in the license file and the user's permissions in the Permission table is considered.

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

Example

The following example opens table 18 (Customer) and creates a RecordRef variable that is named MyRecordRef for the table. The ReadPermission method determines whether the table has read permission and stores the return value in the varHasReadPerm variable. The Customer table has read permission, so the message displays Yes. You can initialize the varTableNo variable with any table number.

var
    MyRecordRef: RecordRef;
    varHasReadPerm: Boolean;
    varTableNo: Integer;
    Text000: Label 'Does the %1 table have read permission? %2'; 
begin      
    varTableNo := 18;  
    MyRecordRef.Open(varTableNo);  
    varHasReadPerm := MyRecordRef.ReadPermission;  
    Message(Text000, MyRecordRef.Name, varHasReadPerm);  
end;

RecordRef Data Type
Get Started with AL
Developing Extensions