ICalendarDimensionClass.Shift

Syntax

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

Description

The Shift method returns index of the element obtained by shifting relatively to the specified element.

Comments

The element calculates shifting within one calendar level by all dictionary levels. If the element obtained as a result of shifting is missing in the calendar, the method returns -1.

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 ShiftEl(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.Shift(DimInst, t, Lag);
    Return Result;
End Function ShiftEl;

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

See also:

ICalendarDimensionClass