Muokkaa

Jaa


FieldRef.Active() Method

Version: Available or changed with runtime version 1.0.

Checks whether the field that is currently selected is enabled.

Syntax

Ok :=   FieldRef.Active()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

Ok
 Type: Boolean

Remarks

Each field in a record can be set as enabled or disabled in the table description. You cannot use a disabled field because disabled fields cannot contain data.

This method is like the FieldActive Method (Record).

Example

The following example opens table 18 (Customer) as a RecordRef variable that is named Recref. The Field Method (RecordRef) uses Recref to create a FieldRef variable that is named MyFieldRef. MyFieldRef sets a reference to the first field (field 1) in the table. The SetRange Method (FieldRef) sets a filter that selects record 30000. The Field Method (RecordRef) selects the record and then loops through fields 1 through 6. For each field, the Active method determines whether the field is enabled. If the field is enabled, a message that states that the field is enabled is displayed. Otherwise, a message that states that the field is not enabled is displayed.

Note

You can use the name of the table instead of the table number to open the table by using the following syntax:

RecRef.Open(DATABASE::Customer)
var
    Recref: RecordRef;
    MyFieldRef: FieldRef;
    i: Integer;
    Text000: Label 'Field %1 is enabled.';
    Text001: Label 'Field %1 is not enabled.';
begin
    Recref.Open(18);  
    MyFieldRef := Recref.Field(1);  
    MyFieldRef.SetRange('30000');  
    Recref.Find('-');  
    for i := 1 to 5 do begin
      MyFieldRef := Recref.FieldIndex(i);  
      if MyFieldRef.Active then  
        Message(Text000, i)  
      else begin 
        Message(Text001, i)  
      end;  
    end;  
end;

FieldRef Data Type
Get Started with AL
Developing Extensions