ICalendarDimensionClass.Shift

Fore Syntax

Shift(Calendar: IDimInstance; El: Integer; Lag: Integer): Integer;

Fore.NET Syntax

Shift(Calendar: Prognoz.Platform.Interop.Dimensions.IDimInstance; El: uinteger; Lag: integer): uinteger;

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.

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

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 ShiftEl(T: object; Lag: integer): 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.Shift(DimInst, el, Lag) As integer;
    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