ReferenceDictionary: IRdsDictionaryInstance;
The ReferenceDictionary property returns data of a linked dictionary.
Executing the example requires the MDM repository NSI_1 that contains an MDM dictionary with the Dict_1 identifier. The dictionary includes the link with any other MDM dictionary. An attribute with the ATTRIBUTE identifier is a linked attribute.
Sub Main;
Var
MB: IMetabase;
Dict: IRdsDictionary;
DictInst, RefDictInst: IRdsDictionaryInstance;
LinkInst: IRdsLinkInstance;
Data: IRdsDictionaryElementData;
Attr: IRDsAttributes;
Begin
MB := MetabaseClass.Active;
Dict := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Bind As IRdsDictionary;
DictInst := Dict.Open(Null);
LinkInst := DictInst.Links.Item(0);
RefDictInst := LinkInst.ReferenceDictionary;
Data := DictInst.CreateElementData;
Attr := Dict.Attributes;
Data.Attribute(Attr.Name.Key) := "Test";
//Linked attribute
Data.Attribute(Attr.FindById("ATTRIBUTE").Key) := RefDictInst.Elements.Item(4).Key;
DictInst.Insert(-2, Data);
End Sub Main;
After executing the example a new element is added to the MDM dictionary root. The forth element of a linked dictionary is chosen as an attribute value.
See also: