LevelNumber: Integer;
LevelNumber: Integer;
The LevelNumber property determines level number of dimension for which elements grouping is enabled.
Level numbering starts with one. By default the property is set to 0, all dimension elements are grouped.
If level is set, then elements of only this level are grouped. Superior levels elements create parent elements with saving the whole hierarchy. Child elements save their hierarchy towards elements of the specified level.
Executing the example requires that the repository contains a data entry form with the DEF identifier. Table area is created in data entry form. The dimension in the sidehead has several levels in the structure and the attribute with the GROUP identifier.
Add links to the Dimensions, Express, Metabase, Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Area: IEaxDataArea;
Slice: IEaxDataAreaPivotSlice;
Dim: IDimInstance;
Hier: IEaxHierarchiesGroupSettings;
HierGroup: IEaxHierarchyGroupSettings;
Arr: Array Of Integer;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get form child object
Report := MB.ItemById("DEF").Children.Item(0).Edit As IPrxReport;
// Get analytical area of child object
Area := Report.DataArea;
// Get analytical data area slice
Slice := Area.Slices.Item(0) As IEaxDataAreaPivotSlice;
Dim := Slice.Pivot.LeftHeader.Dim(0);
// Get properties of groupings collection
Hier := Slice.EaxHierarchiesGroupSettings;
// Get grouping properties
HierGroup := Hier.EaxHierarhyGroupSettings(Dim.Key);
// Change settings
Arr := New Integer[1];
Arr[0] := Dim.Dimension.Attributes.FindById("GROUP").Key;
HierGroup.Attributes := Arr;
HierGroup.LevelNumber := 2;
// Apply changes and save
Report.Recalc;
Report.MetabaseObject.Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Report: IPrxReport;
Area: IEaxDataArea;
Slice: IEaxDataAreaPivotSlice;
Dim: IDimInstance;
Hier: IEaxHierarchiesGroupSettings;
HierGroup: IEaxHierarchyGroupSettings;
Arr: Array Of UInteger;
Begin
// Get repository
MB := Params.Metabase;
// Get form child object
Report := MB.ItemById["DEF"].Children.Item[0].Edit() As IPrxReport;
// Get analytical area of child object
Area := Report.DataArea;
// Get analytical data area slice
Slice := Area.Slices.Item[0] As IEaxDataAreaPivotSlice;
Dim := Slice.Pivot.LeftHeader.Dim[0];
// Get properties of groupings collection
Hier := Slice.EaxHierarchiesGroupSettings;
// Get grouping properties
HierGroup := Hier.EaxHierarhyGroupSettings[Dim.Key];
// Change settings
Arr := New UInteger[1];
Arr[0] := Dim.Dimension.Attributes.FindById("GROUP").Key As uinteger;
HierGroup.Attributes := Arr;
HierGroup.LevelNumber := 1;
// Apply changes and save
Report.Recalc();
Report.MetabaseObject.Save();
End Sub;
After executing the example elements grouping for dimension from table data area sidehead is set. First level elements will be grouped by specified attribute values.
See also: