DisplayAttribute: IRdsAttribute;
The DisplayAttribute property determines an attribute of the linked dictionary, which values are used to display values of the linked attribute of the current dictionary.
Executing the example requires an MDM repository with the NSI_1 identifier. The repository contains MDM dictionaries with the Dict_1 and Dict_2 identifiers.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dict1, Dict2: IRdsDictionary;
Attrs: IRdsAttributes;
LinkAttr: IRdsAttribute;
Link: IRdsLink;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Edit;
Dict1 := MObj As IRdsDictionary;
Dict2 := MB.ItemByIdNamespace("Dict_2", MB.ItemById("NSI_1").Key).Bind As IRdsDictionary;
//Attributes of the first dictionary
Attrs := Dict1.Attributes;
//Attribute to link with the dictionary
LinkAttr := Attrs.Add;
LinkAttr.DataType := DbDataType.Integer;
LinkAttr.Id := "LinkAttr";
LinkAttr.Name := Attribute to link;
//Link with the dictionary
Link := Dict1.Links.Add;
Link.Attribute := LinkAttr;
Link.Reference := Dict2.Attributes.Key;
Link.DisplayAttribute := Dict2.Attributes.Name;
Link.DisplayFormat := RdsReferenceDisplayFormat.KeyAndValue;
Link.Id := "Link";
Link.Name := Link with the dictionary Dict_2;
MObj.Save;
End Sub UserProc;
After executing the example the attribute used to link with the Dict_2 dictionary is created in the first dictionary. The link is established by the Key attribute. The Name attribute of the linked dictionary is used to display values of the link attribute. Values are displayed in the Key (Value) format.
See also: