Compartilhar via


ACTIVE Function (FieldRef)

Checks whether the field that is currently selected is enabled.

Ok := FieldRef.ACTIVE

Parameters

  • FieldRef
    Type: FieldRef Refers to the current field.

Property Value/Return Value

Type: Boolean

true if the field is enabled; otherwise, false.

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 function is like the FIELDACTIVE Function (Record) function.

Example

The following example opens table 18 (Customer) as a RecordRef variable that is named Recref. The FIELD Function (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 Function (FieldRef) sets a filter that selects record 30000. The FIND Function (RecordRef) selects the record and then loops through fields1 through 6. For each field, the ACTIVE function 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).

This example requires that you create the following variables and text constants in the C/AL Globals windows.

Variable name DataType

Recref

RecordRef

MyFieldRef

FieldRef

i

Integer

Text constant ENU value

Text000

Field %1 is enabled.

Text001

Field %1 is not enabled.

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;

See Also

Reference

FieldRef Data Type