Shift(El: Integer; Lag: Integer): Integer;
El. Element index.
Lag. Lag (shift).
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.
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.
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(Null) As IDimInstance;
ClnClass := New CalendarDimInstanceFactory.Create;
ClnInst := ClnClass.CreateCalendarDimInstance(DimInst);
i := ClnInst.Shift(100, 3);
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: