SetParent(Element: Integer; Parent: Integer);
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.
The SetParent method changes a parent element for the element, which key is passed by the Element parameter.
Executing the example requires the MDM repository NSI_1 that contains an MDM dictionary with the Dict_1 identifier.
Sub Main;
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(-2, 0);
Elem2 := Elements.Child(-2, 1);
Elements.SetParent(Elem1, Elem2);
End Sub Main;
After executing the example the second element is set as a parent one for the first root element of a dictionary.
See also: