ITable.Fields

Syntax

Fields: ITableFields;

Description

The Fields property returns an object containing all fields of the table.

Example

Executing the example requires that the repository contains a database with the BD identifier.

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

Table: ITable;

MObj: IMetabaseObject;

f: ITableField;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TABLE;

CrInfo.Id := "New_Table";

CrInfo.Name := "New_Table";

CrInfo.Parent := MB.Root;

MObj := MB.CreateObject(CrInfo).Edit;

Table := MObj As ITable;

Table.Database := Mb.ItemById("BD").Bind As IDatabase;

f := Table.Fields.Add;

f.DataType := DbDataType.String;

f.Id := "Text_Field";

f. Name: = "Text field";

f.Size := 50;

Table.NativeName := "New_Table";

MObj.Save;

End Sub Main;

After executing the example, a new table is created in repository root. The table contains one text field.

See also:

ITable