ICustomDimTree.Add

Syntax

Add(ParentPrimaryKey: Variant): Variant;

Parameters

ParentPrimaryKey. Primary key of parent element.

Description

The Add method adds a new element and returns its primary key.

Comments

If a non-existent or Null value is passed as parent element key, the element is added to the tree root.

Example

Executing the example requires a standard cube with the STD_CUBE identifier in the repository.

Sub UserProc;
Var
    MB: IMetabase;
    Cube: IStandardCube;
    CustDim: ICustomDimension;
    CustDimTree: ICustomDimTree;
    v: Variant;
Begin
    MB := MetabaseClass.Active;
    Cube := MB.ItemById("STD_CUBE").Edit As IStandardCube;
    CustDim := Cube.FactDimension.Dimension As ICustomDimension;
    CustDimTree := CustDim.Tree;
    v := CustDimTree.Add(Null);
    CustDimTree.Name(v) := "New element " + v;
    (Cube As IStandardCube).Save;
End Sub UserProc;

On executing the example a new element is created in element tree root.

See also:

ICustomDimTree