BaseAttribute: IDimAttribute;
The BaseAttribute property determines original attribute basing on unique values of which hierarchy is built.
To determine number of original attribute alternative hierarchy levels, use IDimAttributeHierarchy.Level.
Executing the example requires that the repository contains a table dictionary with the DIM_SEP identifier containing attribute with the NAME identifier.
Add links to the Dimensions, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
dimension: IDimensionModel;
attribute: IDimAttribute;
attributes: IDimAttributes;
attrhierarchy: IDimAttributeHierarchy;
attrhierarchies: IDimAttributeHierarchies;
dimindex: IDimIndex;
id: string;
Begin
// Get repository
mb := MetabaseClass.Active;
// Get dictionary
dimension := mb.ItemById("DIM_SEP").Edit As IDimensionModel;
// Get collection of dictionary attributes
attributes := dimension.Attributes;
// Get the Name attribute
attribute := attributes.FindById("NAME");
// Get collection of dictionary hierarchies
attrhierarchies := dimension.AttributeHierarchies;
// Find alternative hierarchy by level
attrhierarchy := attrhierarchies.FindByAttributeLevel(2, 2);
// Set up original attribute basing on which values hierarchy is built
attrhierarchy.BaseAttribute := attribute;
// Set hierarchy level
attrhierarchy.Level := 2;
// Get attribute index
If attrhierarchy.AttributeIndex <> Null Then
dimindex := attrhierarchy.AttributeIndex;
id := dimindex.Id;
Debug.WriteLine("Identifier of attribute index = " + id)
Else
Debug.WriteLine("Alternative hierarchy does not contain attribute index" + id)
End If;
// Save changes
(dimension As IMetabaseObject).Save;
End Sub UserProc;
After executing the example in alternative hierarchy:
Original attribute basing on which values hierarchy is built will be set.
Level of original attribute hierarchy will be set.
The console displays attribute index identifier, if it is in alternative hierarchy.
See also: