MoveAfter(PrimaryKey: Variant; Element: Variant);
PrimaryKey. Primary key of moved element.
Element. Primary key of the element after which the moved element should be placed.
The MoveAfter method places the element with the PrimaryKey primary key after the element with the Element key.
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;
TreeChild: ICustomDimTreeChildren;
v, v1: Variant;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("CUBE_1").Edit;
Cube := MObj As IStandardCube;
CustDim := Cube.FactDimension.Dimension As ICustomDimension;
CustDimTree := CustDim.Tree;
TreeChild := CustDimTree.RootChildren;
v := TreeChild.Item(0);
v1 := TreeChild.Item(TreeChild.Count - 1);
CustDimTree.MoveAfter(v, v1);
MObj.Save;
End Sub Main;
After executing the example the first root element is placed to the last position.
See also: