ICalendarDimensionClass.UpLevel

Fore Syntax

UpLevel(Calendar: IDimInstance; El: Integer): Integer;

Fore.NET Syntax

UpLevel(Calendar: Prognoz.Platform.Interop.Dimensions.IDimInstance; El: uinteger): uinteger;

Parameters

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

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

Description

The UpLevel method returns index of the element, which is a parent for the specified element.

Comments

If the child element is missing, the method returns -1.

For example, if the calendar dictionary contains Years, Quarters, Months levels and the calculation is executed 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 UpLevel(T: Variant): Integer;
Var
    Cube: ICubeInstance;
    CubeDest: ICubeInstanceDestination;
    DimInsts: ICubeInstanceDimensions;
    DimInst: IDimInstance;
    i: Integer;
    Result: Integer;
    el1: Integer;
Begin
    // Get the current cube
    Cube := CubeClass.CurrentCube;
    CubeDest := Cube.Destinations.DefaultDestination;
    // Get calendar dimension
    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;
    // Execute calculation
    el1 := CalendarDimension.UpLevel(DimInst, t);
    Result := CalendarDimension.IifLevel(DimInst, t, DimCalendarLevel.Year, el1, t);
    // Return result
    Return Result;
End Function UpLevel;

The result of using the relation in the formula of the calculated fact: the value for the elements of annual frequency will be taken from value of the elements corresponding to the first quarters.

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;

Shared Function UpLevel(T: object): Integer;
Var
    cClass: CubeClassClass;
    Cube: ICubeInstance;
    CubeDest: ICubeInstanceDestination;
    DimInsts: ICubeInstanceDimensions;
    DimInst: IDimInstance;
    i: Integer;
    calendDim: CalendarDimension;
    el, el1: uinteger;
    Result: Integer;
Begin
    // Get the current cube
    cClass := New CubeClassClass.Create();
    Cube := cClass.CurrentCube[Null];
    CubeDest := Cube.Destinations.DefaultDestination;
    // Get calendar dimension
    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;
    // Execute calculation
    calendDim := New CalendarDimension.Create();
    el := uinteger.Parse(t.ToString());
    el1 := calendDim.UpLevel(DimInst, el);
    Result := calendDim.IifLevel(DimInst, el, DimCalendarLevel.dclYear, el1, el) As integer;
    // Return result
    Return Result;
End Function UpLevel;

The result of using the relation in the formula of the calculated fact: the value for the elements of annual frequency will be taken from value of the elements corresponding to the first quarters.

See also:

ICalendarDimensionClass