UseInSelection: Boolean;
UseInSelection: Boolean;
The UseInSelection property determines whether index is used on forming selection.
Available values:
True. Index is used on forming the selection. It will be possible to use it in order to save and restore selection by dimension based on dictionary.
Only one unique key used for selection creating can be present in the dictionary. If any index is already used for it, for it the UseInSelection property will be automatically set to False.
False. Index is not used on forming the selection.
Executing the example requires that repository contains table dictionary with the SELECTION_INDEX identifier. This dictionary must be used as dimension in time series database.
Add links to the Dal, Dimensions, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Dim: IStandardDimension;
Indexes: IStandardDimIndexes;
Index: IStandardDimIndex;
Attrs: IStandardDimAttributes;
Attr: IStandardDimAttribute;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get dictionary
Dim := mb.ItemById("SELECTION_INDEX").Edit As IStandardDimension;
// Get dictionary indexes
Indexes := Dim.Indexes;
// Add new index
Index := Indexes.Add;
// Set its name
Index.Name := "Index to generate selection";
// Get dictionary attributes
Attrs := Dim.Attributes;
// Add new attribute
Attr := Attrs.Add;
// Set its parameters
Attr.Name := "Attribute for index";
Attr.DataType := DbDataType.String;
// Determine that created attribute will be used by new index
Index.Attributes.Add(Attr);
// Determine that index is case-sensitive
Index.CaseSensitive := True;
// Determine that index is used to generate selection
Index.UseInSelection := True;
// Save changes
(Dim As IMetabaseObject).Save;
End Sub UserProc;
After executing the example index which can be used to store and restore selection by dimension based on this dictionary will be created in the MDM table dictionary.
The requirements and result of the Fore.NET example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Dim: IStandardDimension;
Indexes: IStandardDimIndexes;
Index: IStandardDimIndex;
Attrs: IStandardDimAttributes;
Attr: IStandardDimAttribute;
Begin
// Get current repository
mb := Params.Metabase;
// Get dictionary
Dim := mb.ItemById["SELECTION_INDEX"].Edit() As IStandardDimension;
// Get dictionary indexes
Indexes := Dim.Indexes;
// Add new index
Index := Indexes.Add();
// Set its name
Index.Name := "Index to generate selection";
// Get dictionary attributes
Attrs := Dim.Attributes;
// Add new attribute
Attr := Attrs.Add();
// Set its parameters
Attr.Name := "Attribute for index";
Attr.DataType := DbDataType.ddtString;
// Determine that created attribute will be used by new index
Index.Attributes.Add(Attr);
// Determine that index is case-sensitive
Index.CaseSensitive := True;
// Determine that index is used to generate selection
Index.UseInSelection := True;
// Save changes
(Dim As IMetabaseObject).Save();
End Sub;
See also: