Muokkaa

Jaa


FieldRef.Number() Method

Version: Available or changed with runtime version 1.0.

Gets the number of a field as an integer.

Syntax

No :=   FieldRef.Number()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

No
 Type: Integer

Remarks

This method is like the FieldNo Method (Record) method.

Example

The following example displays the caption and the field number of the first 10 fields in the Location table. The Location table is open as a RecordRef Data Type object and the reference is stored in the LocationRecref variable. The FieldIndex variable that stores the field index is initialized to 0. The LocationRecref variable uses the FieldIndex Method (RecordRef) to create a FieldRef that is named MyFieldRef for the specified field index. MyFiledRef now references the field that is specified by the FieldIndex. MyFieldref is then used to display the number and caption of the field The Number Method (FieldRef) method retrieves the field number. This is repeated for the first ten fields in the table.

var
    MyFieldRef: FieldRef;
    LocationRecref: RecordRef;
    FieldIndex: Integer;
begin
    LocationRecref.Open(DATABASE::Location);  
    FieldIndex := 0;  
    repeat  
      FieldIndex  := FieldIndex + 1;  
      MyFieldRef := LocationRecref.FieldIndex(FieldIndex);  
      Message('Field Number: %1  Field Caption: %2.' , MyFieldRef.Number, MyFieldRef.Caption);  
    until FieldIndex = 10;  
end;

FieldRef Data Type
Get Started with AL
Developing Extensions