ToLevel(El: Integer; Level: DimCalendarLevel): Integer;
El — element index.
Level — index of the level that contains target element.
The ToLevel method returns index of the element located at the Level level, which is the parent of the El element. This method returns -1 if the dictionary does not include the level passed by the Level parameter.
Sub Main;
Var
MB: IMetabase;
Obj: IMetabaseObjectDescriptor;
CalClass: CalendarDimInstanceFactory;
Dim: IDimInstance;
CalInst: ICalendarDimInstance;
i: Integer;
Begin
Mb:=MetabaseClass.Active;
Obj:=Mb.ItemById("CALENDAR_DIM");
Dim:=Obj.Open(Null) As IDimInstance;
CalClass:=New CalendarDimInstanceFactory.Create;
CalInst:=CalClass.CreateCalendarDimInstance(Dim);
i:=CalInst.ToLevel(100,DimCalendarLevel.Month);
End Sub Main;
After executing the example the "i" variable contains index of the parent month of the 100th dictionary element. Dictionary identifier: CALENDAR_DIM.
See also: