IRdsNonUniqueKeys.FindById

Fore Syntax

FindById(Id: String): IRdsNonUniqueKey;

Fore.NET Syntax

FindById(Id: string): Prognoz.Platform.Interop.Rds.IRdsNonUniqueKey;

Parameters

Id. Identifier of the non-unique key, by which the search is executed.

Description

The FindById method searches a non-unique key by identifier in the MDM dictionary.

Comments

Use the IRdsNonUniqueKeys.Remove method to remove a non-unique key by index.

Fore Example

Executing the example requires the MDM repository with the NSI_1 identifier that contains an MDM dictionary with the DICT_1 identifier. The dictionary must have custom attributes with non-unique keys. The first non-unique key is characterized by the Index_1 index, the second non-unique key is characterized by the 1 key.

Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    Attrs: IRdsAttributes;
    Keys: IRdsNonUniqueKeys;
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;
    Keys.FindById("Index_1");
    Keys.FindByKey(1);
    Keys.Remove(0);
    Keys.RemoveByKey(1);
    MObj.Save;
End Sub UserProc;

After executing the example non-unique keys are found and then removed by specified indexes and keys.

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;
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;
    Keys.FindById("Index_1");
    Keys.FindByKey(1);
    Keys.Remove(0);
    Keys.RemoveByKey(1);
    MObj.Save();
End Sub;

See also:

IRdsNonUniqueKeys