ICalendarDimInstance.Shift

Syntax

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

Parameters

El. Element index.

Lag. Lag (shift).

Description

The Shift method returns index of the element which you get by shifting from the El element by the value passed by the Lag parameter.

Comments

To shift forward in the time interval, specify positive values of the Lag parameter, to shift back, specify negative value.

If the element obtained as a result of shift is missing in calendar, the method returns -1.

Example

Executing the example assumes that repository contains a calendar dictionary with the CALENDAR_DIM identifier.

Sub UserProc;
Var
    MB: IMetabase;
    DimInst: IDimInstance;
    ClnClass: ICalendarDimInstanceFactory;
    ClnInst: ICalendarDimInstance;
    i: Integer;
Begin
    Mb := MetabaseClass.Active;
    DimInst := Mb.ItemById("CALENDAR_DIM").Open(NullAs IDimInstance;
    ClnClass := New CalendarDimInstanceFactory.Create;
    ClnInst := ClnClass.CreateCalendarDimInstance(DimInst);
    i := ClnInst.Shift(1003);
End Sub UserProc;

On executing the example the "i" variable contains the element index obtained by means of shift for 3 value relative to the specified dictionary element.

See also:

ICalendarDimInstance