ICalendarDimensionClass.ToLevel

Syntax

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

Parameters

Calendar. Data of the calendar dictionary, by which calculation is executed.

El. Index of the element, relative to which calculation is executed.

Level. Calendar level, on which calculation is executed.

Description

The ToLevel method returns index of the element corresponding to the specified element on the specified level.

Comments

If the Level level is missing in the calendar dictionary, the method returns -1.

For example, if the calendar dictionary contains Years, Half-years, Quarters levels and the calculation is executed by the Half-year level for:

Example

The example is the function that is used to calculate the relation in a standard cube.

To execute the example, add links to the Cubes and Dimensions system assemblies.

Public Function ToLevel(T: Variant): Integer;
Var
    Cube: ICubeInstance;
    CubeDest: ICubeInstanceDestination;
    DimInsts: ICubeInstanceDimensions;
    DimInst: IDimInstance;
    i: Integer;
    Result: Integer;
Begin
    Cube := CubeClass.CurrentCube;
    CubeDest := Cube.Destinations.DefaultDestination;
    DimInsts := CubeDest.Dimensions;
    For i := 0 To DimInsts.Count - 1 Do
        If (DimInsts.Item(i).Dimension Is ICalendarDimension) Then
            DimInst := DimInsts.Item(i);
        End If;
    End For;
    Result := CalendarDimension.ToLevel(DimInst, t, DimCalendarLevel.Quarter);
    Return Result;
End Function ToLevel;

The result of using the relation in the formula of the calculated fact: the value for all elements will be taken from the appropriate elements of the quarterly frequency.

See also:

ICalendarDimensionClass