Examples of creating a non-unique index in table MDM dictionary table are given in the Fore and Fore.NET languages. This index speeds up query execution.
Executing the example requires a table MDM dictionary with the MDM_DICT_INDEX identifier. This dictionary must 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 table 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;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Dict: IRdsDictionary;
Keys: IRdsNonUniqueKeys;
Key: IRdsNonUniqueKey;
Begin
// Get current repository
MB := Params.Metabase;
// Get table 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;
See also: