IRdsNonUniqueKeys.Clear

Fore Syntax

Clear;

Fore.NET Syntax

Clear();

Description

The Clear method clears all non-unique keys of the MDM dictionary.

Comments

Use the IRdsNonUniqueKeys.Add method to add a new non-unique key of MDM dictionary.

Fore Example

Executing the example requires the MDM repository with the NSI_1 identifier that contains an MDM dictionary with the DICT_1 identifier.

Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    Attrs: IRdsAttributes;
    Keys: IRdsNonUniqueKeys;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace("Dict_1", MB.ItemById("NSI_1").Key).Edit;
    Dict := MObj As IRdsDictionary;
    Attrs := Dict.Attributes;
    Keys := Dict.NonUniqueKeys;
    For i := 0 To Keys.Count - 1 do
        Debug.WriteLine(Keys.Item(i).Name + " " + Keys.Item(i).Id);
    End For;
    Keys.Clear;
    MObj.Save;
End Sub UserProc;

After executing the example the console window shows names and identifiers of non-unique keys, after which all non-unique keys of the MDM dictionary will be removed from the collection.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    Attrs: IRdsAttributes;
    Keys: IRdsNonUniqueKeys;
    Key: IRdsNonUniqueKey;
    i: Integer;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemByIdNamespace["Dict_1", MB.ItemById["NSI_1"].Key].Edit();
    Dict := MObj As IRdsDictionary;
    Attrs := Dict.Attributes;
    Keys := Dict.NonUniqueKeys;
    For i := 0 To Keys.Count - 1 Do
        Key := Keys.Item[i];
        System.Diagnostics.Debug.WriteLine(Key.Name + " " + Key.Id);
    End For;
    Keys.Clear();
    MObj.Save();
End Sub;

See also:

IRdsNonUniqueKeys