ICalendarDimensionClass.ShiftLevel

Syntax

ShiftLevel(Calendar: IDimInstance;
           El: Integer;
           Lag: 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.

Lag. Element shifting.

Level. The level, on which shifting is executed.

Description

The ShiftLevel method returns index of the element obtained by shifting relative to the specified element on the specified level.

Comments

The method calculates shift within one specified calendar level. If the element obtained as a result of shifting is missing in the calendar, the method returns -1. If the specified calendar level is missing, the method throws an exception.

To shift forward within time period, specify negative value of the Lag parameter, to shift backward, specify positive value.

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 ShiftLevel(T: Variant; Lag: Integer): 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.ShiftLevel(DimInst, t, Lag, DimCalendarLevel.Year);
    Return Result;
End Function ShiftLevel;

The result of using a relation in the formula of the calculated fact: the value for all elements of the annual frequency will be shifted. Direction and size of shifting are specified by the user via the Lag input parameter.

See also:

ICalendarDimensionClass