Examples of creating a non-unique index in MDM dictionary table are given in the Fore language. This index speeds up query execution.
Executing the example requires an MDM dictionary with the MDM_DICT_INDEX identifier. This dictionary should contain a non-unique key with the NUI0 identifier. The key includes only simple attributes containing one value.
After executing the examples a non-unique index based on the NUI0 non-unique key is created in the MDM_DICT_INDEX dictionary child table.
NOTE. If non-unique key in the table MDM dictionary contains imported attributes or attributes with multiple values, a non-unique index cannot be created on its basis.
Add links to the Metabase, Rds system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Dict: IRdsDictionary;
Keys: IRdsNonUniqueKeys;
Key: IRdsNonUniqueKey;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get MDM dictionary
Dict := MB.ItemById("MDM_DICT_INDEX").Edit As IRdsDictionary;
// Get collection of non-unique keys of table MDM dictionary
Keys := Dict.NonUniqueKeys;
// Find key with the NUI0 identifier
Key := Keys.FindById("NUI0");
// Create a non-unique index based on this key in dictionary child table
(Key As IMetaIndex).Enabled := True;
// Save changes
(Key.Dictionary As IMetabaseObject).Save;
End Sub UserProc;
See also: