ITableFields.Clear

Syntax

Clear;

Description

The Clear method clears the fields list of the table.

Example

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Table: ITable;

Fields: ITableFields;

Field: ITableField;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemById("Table_1").Edit;

Table := MObj As ITable;

Fields := Table.Fields;

Fields.Clear;

Field := Fields.Add;

Field.Id := "NEWFIELD";

Field.Name := "New field";

Field.DataType := DbDataType.Integer;

MObj.Save;

End Sub Main;

After executing the example, all fields of the table with the Table_1 identifier are removed. One new integer field NEWFIELD is created instead of them.

See also:

ITableFields