NamingFormat: String;
The NamingFormat property determines attribute name format.
Executing the example requires that the repository contains a time series database with the OBJ_FC identifier.
Sub Main;
Var
Mb: IMetabase;
RubrObj: IMetabaseObject;
CatInst: IRubricatorInstance;
DictInst: IMetaDictionaryInstance;
HierarchyInst: IMetaHierarchyInstance;
Mems: IMetaMembersSet;
Mem: IMetaMember;
sAttr: String;
HLevels: IMetaHierarchyLevels;
HLev: IMetaHierarchyLevel;
AttsSet: IMetaAttributesSet;
Attr: IMetaAttribute;
HierarchyAttr: IMetaHierarchyAttributes;
HierarchySetup: IMetaAttributeHierarchySetup;
i: Integer;
Begin
Mb := MetabaseClass.Active;
RubrObj := Mb.ItemById("OBJ_FC").Bind;
CatInst := RubrObj.Open(Null) As IRubricatorInstance;
DictInst := CatInst.GetDictionary(RubricatorDictionary.Facts);
HierarchyInst := DictInst.DefaultHierarchy;
Debug.WriteLine(Before change format of a name:);
Mems := HierarchyInst.GetRootMembers;
If Not Mems.Eof Then
Mem := Mems.Current;
Repeat
Debug.WriteLine(" " + Mem.Name);
Mems.Next;
Until Mems.Eof;
End If;
HLevels := HierarchyInst.Levels;
HLev := HLevels.Item(0);
AttsSet := HLev.Attributes;
For i := 0 To AttsSet.Count - 1 Do
sAttr := AttsSet.Item(i).Id;
HierarchyAttr := HierarchyInst.Attributes;
Attr := HierarchyAttr.FindById(sAttr);
HierarchySetup := (Attr As IMetaAttributeHierarchySetup);
HierarchySetup.NamingFormat := "KEY";
End For;
Debug.WriteLine("");
Debug.WriteLine(After change format of a name:);
Mems := HierarchyInst.GetRootMembers;
If Not Mems.Eof Then
Mem := Mems.Current;
Repeat
Debug.WriteLine(" " + Mem.Name);
Mems.Next;
Until Mems.Eof;
End If;
End Sub Main;
After executing the example, names of attributes hierarchy root elements are displayed in the console window before and after name format is changed.
See also: