ICalendarDimensionClass.ToLevel

Fore Syntax

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

Fore.NET Syntax

ToLevel(Calendar: Prognoz.Platform.Interop.Dimensions.IDimInstance;
           El: uinteger;
           Level: Prognoz.Platform.Interop.Dimensions.DimCalendarLevel): uinteger;

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:

Fore 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.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;

Public Shared Function ToLevel(T: object): integer;
Var
    cClass: CubeClassClass;
    Cube: ICubeInstance;
    CubeDest: ICubeInstanceDestination;
    DimInsts: ICubeInstanceDimensions;
    DimInst: IDimInstance;
    i: integer;
    calendDim: CalendarDimension;
    el: uinteger;
    Result: integer;
Begin
    cClass := New CubeClassClass.Create();
    Cube := cClass.CurrentCube[Null];
    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;
    calendDim := New CalendarDimension.Create();
    el := uinteger.Parse(t.ToString());
    Result := calendDim.ToLevel(DimInst, el, DimCalendarLevel.dclQuarter) As integer;
    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