ICalendarDimension.OffsetDate

Syntax

OffsetDate(Level: DimCalendarLevel): Integer;

Parameters

Level. Calendar level.

Description

The OffsetDate property determines the number of days, by which the start date of selected period is shifted

Comments

Offset can be set for the following level:

If the OffsetDate value is positive, the date is shifted forward, if the value is negative, the date is shifted backward. Name of calendar level takes into account the offset.

If required to set an offset from the end of selected period, set ICalendarDimension.IsDateEnd to True.

Example

Executing the example requires a calendar dictionary with the CALENDARSETUP identifier and weekly frequency. Add links to the Dimensions and Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    CalendarObj: IMetabaseObject;
    Calendar: ICalendarDimension;
Begin
    mb := MetabaseClass.Active;
    CalendarObj := mb.ItemById("CALENDARSETUP").Edit;
    Calendar := CalendarObj As ICalendarDimension;
    If Calendar.WeekLevel.RestDays = DayOfWeekSet.SaturdaySunday Then
        Calendar.OffsetDate(DimCalendarLevel.Week) := -2;
        Calendar.IsDateEnd(DimCalendarLevel.Week) := True;
    End If;
    Calendar.OffsetDate(DimCalendarLevel.Day) := 0;
    CalendarObj.Save;
End Sub UserProc;

Result of executing this example: if the calendar dictionary uses 5-days week, names for Week level elements are to be generated based on the last working day, that is,  they will be offset by two days from the end of the week.

See also:

ICalendarDimension