LevelIndex(LevelNumber: Integer): Integer;
LevelNumber — level number in calendar dictionary structure depending on the selected hierarchy. Level numbering starts from zero.
The LevelIndex property returns level index by number in the calendar dictionary structure. This number is passed by the LevelNumber parameter.
Various calendar levels can be used in a calendar dictionary depending on selected hierarchy type. The order of levels differs for different types of hierarchy. This property returns unique level index by level number in selected hierarchy.
This property returns one of the following values:
Level index | Level name |
0 | Root. |
1 | Year. |
2 | Half-year. |
3 | Quarters. |
4 | Months. |
5 | Days. |
6 | Composite level: Half-years - 9 Months. |
7 | Composite level: Half-years - Quarters - 9 Months. |
8 | Weeks. |
Executing the example assumes that repository contains a calendar dictionary with the ClnDim identifier.
Sub Main;
Var
MB: IMetabase;
CDim: ICalendarDimension;
Begin
MB := MetabaseClass.Active;
CDim := MB.ItemById("ClnDim").Bind As ICalendarDimension;
Debug.WriteLine(CDim.LevelIndex(0));
Debug.WriteLine(CDim.LevelIndex(1));
Debug.WriteLine(CDim.LevelIndex(2));
End Sub Main;
If the Years - Half-years - Quarters - Months - Days hierarchy type is used, this code returns the following values:
0
1
2
These values correspond to the following levels:
0 - Root level that exists regardless of hierarchy.
1 - Years level.
2 - Half-years level.
If the Years - (Half-years - Quarters - 9 months) - Months - Days hierarchy type is used, this code returns the following values:
0
1
7
These values correspond to the following levels:
0 - Root level that exists regardless of hierarchy.
1 - Years level.
7 - Composite block of levels: Half-years - Quarters - 9 Months.
See also: