FindByKey(Key: Integer): ITableForeignKey;
Key. Key of an external key.
The FindByKey method searches for the external key in the collection by its personal key.
If an external key with selected key is not found, the method returns Null.
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.FindByKey("2");
If Key <> Null Then
Debug.WriteLine(Key.Name);
End If;
End If;
End Sub UserProc;
After executing the example the external key with the key 2 is searched for in the TABLE_L table. If the external key is found, its name is displayed in the console window.
See also: