Exchange(AttrFrom: IMetaAttribute; AttrTo: IMetaAttribute);
AttrFrom - attribute that should be moved.
AttrTo - attribute that should be moved.
The Exchange method exchanges attribute locations in the hierarchy. After executing the example the attribute specified in the AttrFrom parameter is moved to the location of the attribute specified in the AttrTo parameter.
Executing the example requires that the repository contains a time series database with the OBJ_FC identifier.
Sub Main;
Var
Mb: Imetabase;
Rubr: IRubricator;
Facts: IMetaDictionary;
i: Integer;
Hierarchy: IMetaHierarchy;
HAttributes: IMetaHierarchyAttributes;
Begin
Mb := MetabaseClass.Active;
Rubr := MB.ItemById("OBJ_FC").Bind As IRubricator;
Facts := Rubr.Facts;
Hierarchy := Facts.DefaultHierarchy;
HAttributes := Hierarchy.Attributes;
i := HAttributes.Count-1;
HAttributes.Exchange(HAttributes.Item(0), HAttributes.Item(i));
End Sub Main;
After executing the example the first and the last attribute exchanges their locations in the hierarchy.
See also: