HierarchyParameterKey: Integer;
The HierarchyParameterKey property determines the parameter key that will be used to select alternative hierarchy.
It is relevant if the HierarchyTypeSource property is set to AltHierarchySourceEnum.FromParam. As a value specify key of the parameter created in the data entry form. The parameter should be based on the dictionary, which structure contains a special attribute. Values if this attribute should be keys of the dictionaries, based on which alternative hierarchies are built for the dictionary, on which the current dimension is based.
Executing the example requires that the repository contains a data entry form with the DEF_DORM identifier. A table area is created in the data entry form. A dimension based on the DICT_FIRMS dictionary is added in the table area. Alternative hierarchies are created for the dictionary. The data entry form should also contain a parameter based on any dictionary with the ALT_KEY attribute in its structure. The values of this attribute should be keys of the dictionaries, which are alternative hierarchies for the DICT_FIRMS dictionary.
Add links to the Dimensions and Metabase system assemblies. Add links to the assemblies required for working with data entry forms.
Sub UserProc;
Var
Mb: IMetabase;
DEF: IDataEntryForm;
TArea: IDefTableArea;
AltParam: IDefParameter;
Dim: IDefDimension;
Begin
Mb := MetabaseClass.Active;
// Data entry/output form
DEF := New DataEntryForm.CreateByDataEntryForm(Mb.ItemById("DEF_FORM"), True);
// Parameter for selecting alternative hierarchy
AltParam := DEF.Parameters.Item(0);
// Get dimension
TArea := DEF.InputAreas.Item(0) As IDefTableArea;
Dim := TArea.DefDimensions.ItemByKey(Mb.GetObjectKeyById("DICT_FIRMS"));
// Alternative hierarchy for dimension
Dim.HierarchyTypeSource := AltHierarchySourceEnum.FromParam;
Dim.HierarchyParameterKey := AltParam.Key;
Dim.HierarchyParameterAttributeKey := AltParam.DimensionInstance.Dimension.Attributes.FindById("ALT_KEY").Key;
// Apply changes
DEF.InputAreas.ApplyAreaToReport(TArea.Id);
// Save changes
DEF.Save;
DEF._Dispose;
End Sub UserProc;
After executing the example the specified table area dimension settings are changed. The alternative hierarchy that will be displayed as value of dimension elements will be selected by means of the existing data entry form parameter.
See also: