FindById(Id: Integer): ITableForeignKey;
FindById(Id: integer): Prognoz.Platform.Interop.Db.ITableForeignKey;
Id. External key identifier.
The FindById method searches for an external key in collection by its identifier.
If an external key with selected identifier 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.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.
Executing the example requires that the repository contains a table with the TABLE_L identifier.
Imports Prognoz.Platform.Interop.Db;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Table: ITable;
FKeys: ITableForeignKeys;
Key: ITableForeignKey;
Begin
mb := Params.Metabase;
Table := mb.ItemById["TABLE_L"].Bind() As ITable;
FKeys := Table.ForeignKeys;
If FKeys.Count > 0 Then
Key := FKeys.FindById("FK");
If Key <> Null Then
System.Diagnostics.Debug.WriteLine(Key.Name);
End If;
End If;
End Sub;
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: