IRdsAttribute.Link

Syntax

Link: IRdsLink;

Description

The Link property determines link with other dictionaries for this attribute.

Example

Executing the example requires an MDM repository NSI_1 that contains the MDM dictionary with the Dict_1 and Dict_2 identifiers. For the second dictionary unique identifier GUID must be available in elements.

Sub UserProc;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Dict, Dict2: IRdsDictionary;

Attrs: IRdsAttributes;

LinkAttr, LookupAttr: IRdsAttribute;

Link: IRdsLink;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Edit;

Dict := MObj As IRdsDictionary;

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

//Attributes of the first dictionary

Attrs := Dict.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 := Dict.Links.Add;

Link.Attribute := LinkAttr;

Link.Reference := Dict2.Attributes.Key;

Link.Id := "Link";

Link.Name := Link with the dictionary Dict_2;

//Imported attribute GUID

LookupAttr := Attrs.Add;

LookupAttr.Id := "Dict2_GUID";

LookupAttr.Name := "GUID";

LookupAttr.Link := Link;

LookupAttr.Lookup := Dict2.Attributes.GUID;

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 performed by the attribute Key, then the imported attribute that refers to the attribute GUID of the second dictionary is created in the first dictionary.

See also:

IRdsAttribute