Determines the table relationship of a given field.
TableNumber := Record.RELATION(Field)
- Type: Record The record that contains Field.
- Type: Field The field for which you want to find the table relationship.
Property Value/Return Value
The number of the table that has a relationship with Field. This relationship is set up through the properties.
You can use this function for several purposes, such as to determine lookups or to check if you have permission to read from a table.
The following example displays the number of the table that has a relation with the City field in the Customer table. In this example, table number 225, the Post Code table, is displayed because a table relation exists in the City field. If a relation does not exist, then an error message is displayed. This example requires that you create the following variables in the C/AL Globals window.
varTableNumber := CustomerRec.RELATION (CustomerRec.City); MESSAGE('%1', varTableNumber);