# FieldRef.Relation() Method
> Version: _Available or changed with runtime version 1.0._
Finds the table relationship of a given field.
## Syntax
```al
TableNumber :=   FieldRef.Relation()
```
> NOTE
> This method can be invoked using property access syntax.
## Parameters
FieldRef
Type: fieldref-data-type
An instance of the fieldref-data-type data type.
## Return Value
TableNumber
Type: ../integer/integer-data-type
## 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 ../record/record-relation-method.
## 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.
```al
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;
```
## Related information
fieldref-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/fieldref/fieldref-relation-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/fieldref/fieldref-relation-method/
