Executing the example requires a standard cube with the CUBE_1 identifier.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Cube: IStandardCube;
CustDim: ICustomDimension;
CustDimTree: ICustomDimTree;
Root1, Root2, Child1, Child2: Variant;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("CUBE_1").Edit;
Cube := MObj As IStandardCube;
CustDim := Cube.FactDimension.Dimension As ICustomDimension;
CustDimTree := CustDim.Tree;
Root1 := CustDimTree.Add(Null);
Root2 := CustDimTree.Add(Null);
Child1 := CustDimTree.Add(Root1);
Child2 := CustDimTree.Add(Root2);
CustDimTree.Name(Root1) := First root;
CustDimTree.Name(Root2) := Second root;
CustDimTree.Name(Child1) := First child;
CustDimTree.Name(Child2) := Second child;
MObj.Save;
End Sub Main;
After executing the example new elements are created in fact dimension. Elements are displayed as a tree.
See also: