ITableFields.Add

Syntax

Add: ITableField;

Description

The Add method creates a new table field.

Example

Sub Main;

Var

MB: IMetabase;

Object: IMetabaseObject;

Table: ITable;

Fields: ITableFields;

Field: ITableField;

Begin

MB:=MetabaseClass.Active;

Object:=MB.ItemById("TABLE_1").Edit;

Table:=Object As ITable;

Fields:=Table.Fields;

Field:=Fields.Add;

Field.DataType:=DbDataType.String;

Field.Id:="Text_Field";

Field.Name: = "Text field";

Field.Size:=50;

Object.Save;

End Sub Main;

After executing the example, one field is created in the table with the Table_1 identifier. Field identifier is Text_Field, data type is string, field length is 50.

See also:

ITableFields