RecordRef.FieldExist(Integer) Method

Version: Available or changed with runtime version 1.0.

Determines if the field that has the number FieldNo exists in the table that is referred to by the RecordRef. Returns an error if no table is currently selected.

Syntax

Exist :=   RecordRef.FieldExist(FieldNo: Integer)

Parameters

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

FieldNo
 Type: Integer
The FieldNo that you want to know whether exists in the table.

Return Value

Exist
 Type: Boolean
true if the field exists; otherwise false.

Example

The following example opens table 18 (Customer) as a RecordRef variable that is named MyRecordRef. The code loops through fields 1 through 12 and uses the FieldEXIST method to determine whether the specified field exists. If the field exists, the name of the field and a message that indicates that the field exists is displayed. Otherwise, a message that indicates that the field does not exist is displayed.

var
    MyRecordRef: RecordRef;
    i: Integer;
    VarFieldName: FieldRef;
    Text000: Label 'The %1 table contains %2 field\(s\).\\';
begin  
    MyRecordRef.Open(18);  
    for i := 1 to 12 do begin  
      if MyRecordRef.FieldExist(i) then begin  
         VarFieldName := MyRecordRef.Field(i);  
         Message(Text000, i, VarFieldName.Name);  
        end else  
        Message(Text001, i);  
      end;  
end;

See Also

RecordRef Data Type
Get Started with AL
Developing Extensions