AttributeMnemoNamings: IMetaAttributeNamings;
AttributeMnemoNamings: Prognoz.Platform.Interop.Rds.IMetaAttributeNamings;
The AttributeMnemoNamings property returns a collection of attribute names to generate mnemonic.
The IMetaAttributeNaming.MnemoPrefix and IMetaAttributeNaming.MnemoSuffix properties determine characters used as delimiters of attributes names.
Executing the example requires that repository contains a time series database with the TSDB identifier.
Add links to the Cubes, Metabase, Rds system assemblies.
Sub UserProc;
Var
DicEdit: IMetaDictionary;
Nams: IMetaAttributeNamings;
Nam: IMetaAttributeNaming;
Ni, Nc: Integer;
Atrs: IMetaAttributes;
Atr: IMetaAttribute;
Dims: ICubeModelDimensionsEx;
Dim: ICubeModelDimensionEx;
Di, Dc: Integer;
Rubricator: IRubricator;
Mb: IMetabase;
RubI: IRubricatorInstance;
FactorKeys: Array Of Integer;
FactsLookup: IRubricatorFactsLookup;
Begin
// Get repository
Mb := MetabaseClass.Active;
// Get time series database
Rubricator := Mb.ItemById("TSDB").Edit As IRubricator;
// Edit time series dictionary
DicEdit := Rubricator.EditFacts;
// Update dictionary sequence
DicEdit.UpdateSequence(RdsUpdateSequenceOptions.Key);
// Get time series attributes
Atrs := DicEdit.Attributes;
// Get collection of attributes names to generate mnemonic
Nams := DicEdit.AttributeMnemoNamings;
// Clear names collection
Nc := Nams.Count - 1;
For Ni := Nc To 0 Step - 1 Do
Nam := Nams.Item(Ni);
Nams.Remove(Nam);
End For;
// Get dimensions of the time series database
Dims := Rubricator.Dimensions;
// Count dimensions of time series database
Dc := Dims.Count - 1;
For Di := 0 To Dc Do
Dim := Dims.Item(Di);
// If dimension is a link to dictionary,
// add the NAME attribute to generation rules
// of time series mnemonics.
Atr := Atrs.FindByValuesObject(Dim.DimensionO.Key);
If Atr <> Null Then
Nam := Nams.Add(Atr);
nam.NamingFormat := "NAME";
// Set suffix for mnemonics
nam.MnemoSuffix := "|";
End If;
End For;
// Save changes
(DicEdit As IMetabaseObject).Save;
// Get instance of time series database
RubI := (Rubricator As IMetabaseObject).Open(Null) As IRubricatorInstance;
// Get keys of all time series
FactsLookup := RubI.CreateFactsLookup;
FactorKeys := FactsLookup.LookupFactors;
// Regenerate mnemonics
RubI.RegenerateMnemo(FactorKeys);
End Sub UserProc;
After executing the example rules of series mnemonics generation will be set and suffix for attributes included in the mnemonic will be also set for time series database. Then mnemonics are generated with new rules.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
DicEdit: IMetaDictionary;
Nams: IMetaAttributeNamings;
Nam: IMetaAttributeNaming;
Ni, Nc: Integer;
Atrs: IMetaAttributes;
Atr: IMetaAttribute;
Dims: ICubeModelDimensionsEx;
Dim: ICubeModelDimensionEx;
Di, Dc: Integer;
Rubricator: IRubricator;
Mb: IMetabase;
RubI: IRubricatorInstance;
FactorKeys: System.Array;
FactsLookup: IRubricatorFactsLookup;
Begin
// Get repository
Mb := Params.Metabase;
// Get time series database
Rubricator := Mb.ItemById["TSDB"].Edit() As IRubricator;
// Edit time series dictionary
DicEdit := Rubricator.EditFacts;
// Update dictionary sequence
DicEdit.UpdateSequence(RdsUpdateSequenceOptions.rusoKey);
// Get time series attributes
Atrs := DicEdit.Attributes;
// Get collection of attributes names for mnemonic generation
Nams := DicEdit.AttributeMnemoNamings;
// Clears names collection
Nc := Nams.Count - 1;
For Ni := Nc To 0 Step - 1 Do
Nam := Nams.Item[Ni];
Nams.Remove(Nam);
End For;
// Get dimensions of time series database
Dims := Rubricator.Dimensions;
// Count dimensions of time series database
Dc := Dims.Count - 1;
For Di := 0 To Dc Do
Dim := Dims.Item[Di];
// If dimension is a link to the dictionary,
// add the NAME attribute to generation rules
// of time series mnemonics.
Atr := Atrs.FindByValuesObject(Dim.DimensionO.Key);
If Atr <> Null Then
Nam := Nams.Add(Atr);
nam.NamingFormat := "NAME";
// Set suffix for mnemonics
nam.MnemoSuffix := "|";
End If;
End For;
// Save changes
(DicEdit As IMetabaseObject).Save();
// Get instance of time series database
RubI := (Rubricator As IMetabaseObject).Open(Null) As IRubricatorInstance;
// Get keys of all time series
FactsLookup := RubI.CreateFactsLookup();
FactorKeys := FactsLookup.LookupFactors();
// Regenerate mnemonics
RubI.RegenerateMnemo(FactorKeys);
End Sub;
See also: