ITableForeignKeys.FindById

Syntax

FindById(Id: Integer): ITableForeignKey;

Parameters

Id. External key identifier.

Description

The FindById method searches for an external key in collection by its identifier.

Comments

If an external key with selected identifier is not found, the method returns Null.

Example

Executing the example requires that the repository contains a table with the TABLE_L identifier.

Add links to the Metabase, Db system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Table: ITable;
    FKeys: ITableForeignKeys;
    Key: ITableForeignKey;
Begin
    mb := MetabaseClass.Active;
    Table := mb.ItemById("TABLE_L").Bind As ITable;
    FKeys := Table.ForeignKeys;
    If FKeys.Count > 0 Then
        Key := FKeys.FindById("FK");
        If Key <> Null Then
            Debug.WriteLine(Key.Name);
        End If;
    End If;
End Sub UserProc;

After executing the example the external key with the FK identifier is searched for in the TABLE_L table. If the key is found, its name is displayed in the console window.

See also:

ITableForeignKeys