IRdsDictionaryElements.SetParent

Syntax

SetParent(Element: Integer; Parent: Integer);

Parameters

Element - element key, for which it is necessary to change a parent element.

Parent - element key, which is necessary to set as a parent for the Element element.

Description

The SetParent method changes a parent element for the element, which key is passed by the Element parameter.

Example

Executing the example requires the MDM repository NSI_1 that contains an MDM dictionary with the Dict_1 identifier.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Dict: IRdsDictionary;
    DictInst: IRdsDictionaryInstance;
    Elements: IRdsDictionaryElements;
    Elem1, Elem2: Integer;
Begin
    MB := MetabaseClass.Active;
    Dict := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Bind As IRdsDictionary;
    DictInst := Dict.Open(Null);
    Elements := DictInst.Elements;
    Elem1 := Elements.Child(-20);
    Elem2 := Elements.Child(-21);
    Elements.SetParent(Elem1, Elem2);
End Sub Button1OnClick;

After executing the example the second element is set as a parent one for the first root element of a dictionary.

See also:

IRdsDictionaryElements