OffsetDate(Level: DimCalendarLevel): Integer;
OffsetDate[Level: Prognoz.Platform.Interop.Dimensions.DimCalendarLevel]: integer;
Level. Calendar level.
The OffsetDate property determines the number of days, by which the start date of selected period is shifted
Offset can be set for the following level:
Years. Level = DimCalendarLevel.Year;
Quarters. Level = DimCalendarLevel.Quarter.
Months. Level = DimCalendarLevel.Month.
Weeks. Level = DimCalendarLevel.Week.
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.
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.
Executing the example requires a calendar dictionary with the CALENDARSETUP identifier and weekly frequency.
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
CalendarObj: IMetabaseObject;
Calendar: ICalendarDimension;
Begin
mb := Params.Metabase;
CalendarObj := mb.ItemById["CALENDARSETUP"].Edit();
Calendar := CalendarObj As ICalendarDimension;
If Calendar.WeekLevel.RestDays = DayOfWeekSet.dowsSaturdaySunday Then
Calendar.OffsetDate[DimCalendarLevel.dclWeek] := -2;
Calendar.IsDateEnd[DimCalendarLevel.dclWeek] := True;
End If;
CalendarObj.Save();
End Sub;
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: