AttachTable(Value: ITable; [BuildAttributes: Boolean = True]);
Value - table to store values.
BuildAttributes - parameter that determines whether definitions of dictionary attributes by table fields are created. Optional parameter. Default value is True - definitions of attributes by table fields are created.
The AttachTable method sets a table to store attribute values.
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.
Add links to the Metabase, Rds, Db system assemblies.
Sub UserProc;
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);
ObjMb.Save;
End Sub UserProc;
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: