IRdsDictionaryElements.Insert

Syntax

Insert(Parent: Integer; Data: IRdsDictionaryElementData): Integer;

Parameters

Parent. Parent element, a new element is added into a branch of its child elements.

Data. New element data.

Description

The Insert method inserts a new element, which data is passed by the Data parameter, and returns a key of inserted element.

Example

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

Sub Main;

Var

MB: IMetabase;

Dict: IRdsDictionary;

Attrs: IRdsAttributes;

DictInst: IRdsDictionaryInstance;

Elements: IRdsDictionaryElements;

Data: IRdsDictionaryElementData;

Key: Integer;

Begin

MB := MetabaseClass.Active;

Dict := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Bind As IRdsDictionary;

Attrs := Dict.Attributes;

DictInst := Dict.Open(Null);

Elements := DictInst.Elements;

Data := Elements.CreateData;

Data.Value(Data.AttributeIndex(Attrs.Name.Key)) := New element;

Key := Elements.Insert(-2, Data);

End Sub Main;

After executing the example an object that contains data is created. A new element is created on the base of this data.

See also:

IRdsDictionaryElements