Add(Value: IMetaAttribute): Integer;
Value - added attribute.
The Add method adds an attribute to a set and returns index of the added attribute in the set.
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_CTR identifier.
Sub Main;
Var
MB: IMetabase;
Rubr: IRubricator;
Facts: IMetaDictionary;
Atts: IMetaAttributes;
Attr: IMetaAttribute;
SS: IMetaAttributesSubset;
Rds: IMetabaseObjectDescriptor;
i: Integer;
Begin
MB := MetabaseClass.Active;
Rubr := MB.ItemById("OBJ_FC").Bind As IRubricator;
Facts := Rubr.Facts;
Atts := Facts.Attributes;
SS := Atts.CreateSubset("KEY;REV", SubsetOperation.Select_);
Rds := mb.ItemById("RDS_REPO");
Attr := Atts.FindByValuesObject(MB.GetObjectKeyByIdNamespace("DICT_CTR", Rds.Key));
If Attr <> Null Then
SS.Add(Attr);
End If;
For i := 0 To SS.Count - 1 Do
Debug.WriteLine(SS.Item(i).Name);
End For;
End Sub Main;
After executing the example a set that consists of the attributes KEY and REV is created. If the database time series have an attribute that refers to the DICT_CTR dictionary in the MDM repository, this attribute is also added to the set. Names of all attributes included in the set are displayed in the console window.
See also: