Editar

Partilhar via


FieldRef.Relation() Method

Version: Available or changed with runtime version 1.0.

Finds the table relationship of a given field.

Syntax

TableNumber :=   FieldRef.Relation()

Note

This method can be invoked using property access syntax.

Parameters

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

Return Value

TableNumber
 Type: Integer

Remarks

You can use this method for several purposes such as to determine lookups or to check to see if you have permission to read from a table.

This method is similar to the Relation Method (Record).

Example

The following example opens table 37, the Sales Line table, as a RecordRef variable and creates a reference to field 2 (Sell-to Customer No.). The FieldRef Data Type of field 2 is stored in the MyFieldRef variable. The RELATION method retrieves the number of the table that has a relation with the Sell-To-Customer field (field 2). The table number is stored the varRelation variable and displayed in the message box.

var
    MyFieldRef: FieldRef;
    SaleRecref: RecordRef;
    varRelation: Integer;
    Text000: Label 'Field 2 in the Sales Line (37) table has a relation with table %1.';
begin
    SaleRecref.Open(37);  
    MyFieldRef := SaleRecref.Field(2);  
    varRelation := MyFieldRef.Relation;  
    Message(Text000, varRelation);  
end;

FieldRef Data Type
Get Started with AL
Developing Extensions