BuildCollectionAttributes;
The BuildCollectionAttributes method creates attributes necessary to store multiple values in a system table. It is necessary to use this method to create an attribute that supports multiple values.
Executing the example requires that the repository contains a time series database with the OBJ_FC identifier and an MDM repository with the RDS_REPO identifier. The MDM repository must contain a dictionary with the DICT_COUNTRY identifier.
Sub Main;
Var
MB: IMetabase;
Rubr: IRubricator;
Facts: IMetabaseObject;
Att: IMetaAttribute;
CollectionAtt: IMetaAttributes;
Begin
MB := MetabaseClass.Active;
Rubr := MB.ItemById("OBJ_FC").Bind As IRubricator;
Facts := (Rubr.Facts As IMetabaseObject).Edit;
Att := (Facts As IMetaDictionary).Attributes.Add;
Att.DataType := DbDataType.Integer;
Att.Id := "A_M_REF";
Att.Name := New attribute;
Att.Kind := (MetaAttributeKind.Collection) Or (MetaAttributeKind.Dimension);
Att.ValuesObject := MB.ItemByIdNamespace("DICT_COUNTRY", Mb.ItemById("RDS_REPO").Key);
Att.DataType := DbDataType.Integer;
Att.HasMultipleValues := True;
CollectionAtt := Att.CollectionAttributes;
CollectionAtt.BuildCollectionAttributes;
CollectionAtt.CreateTable(True);
Facts.Save;
End Sub Main;
After executing the example, an attribute named New Attribute, that is a link to the dictionary (DICT_COUNTRY) and supports multiple values, is added to the time series database (OBJ_FC). A system table is also created to store multiple values of an attribute.
See also: