IMetaAttributes.BuildAttributesByFields

Syntax

BuildAttributesByFields;

Description

The BuildAttributesByFields method creates definitions of attributes by table fields.

Example

Executing the example requires an MDM repository with the RDS_REPO identifier, a database with the DB identifier and a table with the OBJ_TABLE identifier.

Sub Main;

Var

Mb: Imetabase;

ObjMb: IMetabaseObject;

RDS: IMetabaseObjectDescriptor;

Dict: IMetaDictionary;

CrInfo: IMetabaseObjectCreateInfo;

Des: IMetabaseObjectDescriptor;

Attributes: IMetaAttributes;

Table: ITable;

Begin

Mb := MetabaseClass.Active;

CrInfo := Mb.CreateCreateInfo;

CrInfo.Id := "DICT_AT";

CrInfo.Name := "Dict_At";

CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_METADICTIONARY;

RDS := Mb.ItemById("RDS_REPO");

CrInfo.Parent := RDS;

Des := Mb.CreateObject(CrInfo);

ObjMb := Des.Edit;

Dict := ObjMb.GetExtensionDispatch As IMetaDictionary;

Dict.Database := Mb.ItemById("DB").Bind As IDatabase;

Attributes := Dict.Attributes;

Table := Mb.ItemById("OBJ_TABLE").Bind As ITable;

Attributes.AttachTable(Table, False);

Attributes.BuildAttributesByFields;

ObjMb.Save;

End Sub Main;

After executing the example an object (the DICT_AT identifier) used to store system information is created in the MDM repository. A table to store values (OBJ_TABLE) is determined for an object. Definitions of attributes are created by fields of this table.

See also:

IMetaAttributes