CreateElementData: IRdsDictionaryElementData;
The CreateElementData method creates an object that contains data of the MDM dictionary element. This object can be further used to create new ones, search or update already existing dictionary elements.
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;
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.CreateElementData;
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 element data is created. A new element is created on the base of this data. The Key variable contains a key of created element.
See also: