FindById(Id: String): IRdsNonUniqueKey;
Id. Identifier of the non-unique key, by which the search is executed.
The FindById method searches a non-unique key by identifier in the MDM dictionary.
Use the IRdsNonUniqueKeys.Remove method to remove a non-unique key by index.
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.
See also: