Remove(ForeignKey: Integer): Boolean;
Remove(ForeignKey: integer): Boolean;
ForeignKey. Index of the external key to be removed.
The Remove method removes an external key with specified index from collection.
Indexation of external keys in the collection is continuous and starts with zero. The ITableForeignKeys.Count property returns the number of external keys in collection.
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").Edit As ITable;
FKeys := Table.ForeignKeys;
If FKeys.Count > 0 Then
Debug.WriteLine(FKeys.Remove(0));
End If;
(Table As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the first external key is removed from the TABLE_L table.
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"].Edit() As ITable;
FKeys := Table.ForeignKeys;
If FKeys.Count > 0 Then
System.Diagnostics.Debug.WriteLine(FKeys.Remove(0));
End If;
(Table As IMetabaseObject).Save();
End Sub;
After executing the example the last external key is removed from the TABLE_L table.
See also: