IRdsUniqueKey.Contains

Syntax

Contains(Attribute: IRdsAttribute): Boolean;

Parameters

Attribute. MDM dictionary attribute, for which we define if it is included into unique key.

Description

The Contains property determines whether the specified attribute is included into unique key of the MDM dictionary.

Comments

Available values:

Example

Executing the example requires an MDM repository with the RDS_REPO identifier that contains an MDM dictionary with the RDS_DICT identifier.

Add links to the Metabase, Rds, Dal system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    Attrs: IRdsAttributes;
    Attr: IRdsAttribute;
    UniqKeys: IRdsUniqueKeys;
    UniqKey: IRdsUniqueKey;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace(
"RDS_DICT", MB.ItemById("RDS_REPO").Key).Edit;
    Dict := MObj 
As IRdsDictionary;
    
// Create a new attribute
    Attrs := Dict.Attributes;
    UniqKeys := Dict.UniqueKeys;
    Attr := Attrs.Add;
    Attr.DataType := DbDataType.String;
    Attr.Name := 
"State number";
    
// Create the unique key
    UniqKey := UniqKeys.Add;
    UniqKey.Name := 
"Unique key by state number";
    UniqKey.Contains(Attr) := 
True;
    
// Check if elements' values are unique
    UniqKey.Check;
    
// Save changes
    (UniqKey.Dictionary As IMetabaseObject).Save;
End Sub UserProc;

After executing the example a custom attribute is created in the MDM dictionary. A unique key of MDM dictionary is created by this attribute.

See also:

IRdsUniqueKey