ICustomDimTree.MoveBefore

Syntax

MoveBefore(PrimaryKey: Variant; Element: Variant);

Parameters

PrimaryKey. Primary key of moved element.

Element. Primary key of the element before which the moved element should be placed.

Description

The MoveBefore method places the element with the PrimaryKey primary key before the element with the Element key.

Example

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(TreeChild.Count - 1);

v1 := TreeChild.Item(TreeChild.Count - 2);

CustDimTree.MoveBefore(v, v1);

MObj.Save;

End Sub Main;

After executing the example the last root element is moved one position up.

See also:

ICustomDimTree