ICalendarDimInstance.ToLevel

Syntax

ToLevel(El: Integer; Level: DimCalendarLevel): Integer;

Parameters

El — element index.

Level — index of the level that contains target element.

Description

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.

Example

Sub UserProc;
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(NullAs IDimInstance;
    CalClass:=New CalendarDimInstanceFactory.Create;
    CalInst:=CalClass.CreateCalendarDimInstance(Dim);
    i:=CalInst.ToLevel(100,DimCalendarLevel.Month);
End Sub UserProc;

After executing the example the "i" variable contains index of the parent month of the 100th dictionary element. Dictionary identifier: CALENDAR_DIM.

See also:

ICalendarDimInstance