UseInSelection: Boolean;
The UseInSelection property determines whether unique key is used on selection creating.
Available values:
True. The unique key is used on selection creating. It will be possible to use it in order to save and restore selection by dimension based on the MDM dictionary.
Only one unique key used for selection creating can be present in the MDM dictionary. If any key is already used for it, for it the UseInSelection property will be automatically set to False.
False. The unique key is not used for selection creating.
Executing the example requires that the repository contains MDM dictionary with the USE_IN_SELECTION identifier. This dictionary must be out of MDM repository and must be used only as dimension in time series database.
Add links to the Dal, Metabase and Rds system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Dict: IRdsDictionary;
UniqueKeys: IRdsUniqueKeys;
UniqueKey: IRdsUniqueKey;
Attributes: IRdsAttributes;
Attribute: IRdsAttribute;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get MDM dictionary
Dict := mb.ItemById("USE_IN_SELECTION").Edit As IRdsDictionary;
// Get dictionary unique keys
UniqueKeys := Dict.UniqueKeys;
// Add new key
UniqueKey := UniqueKeys.Add;
// Get dictionary attributes
Attributes := Dict.Attributes;
// Add new attribute
Attribute := Attributes.Add;
// Set name and type of attribute data
Attribute.Name := "Unique key";
Attribute.DataType := DbDataType.String;
// Set that created attribute is included in the new unique key
UniqueKey.Contains(Attribute) := True;
// Set that unique key will be used on selection creating
UniqueKey.UseInSelection := True;
// Set that unique key is case-sensitive
UniqueKey.CaseSensitive := True;
// Save changes in the MDM dictionary
(Dict As IMetabaseObject).Save;
End Sub UserProc;
After executing the example unique key, which can be used to store and restore selection by dimension based on this dictionary will be created in the MDM dictionary.
See also: