ICalendarDimension.StartYear

Syntax

StartYear: Integer;

Description

The StartYear property determines fixed year when the calendar dictionary starts.

Example

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Calendar: ICalendarDimension;

CalAttr: ICalendarDimAttribute;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_CLNDIM;

CrInfo.Id := "CalendarDim";

CrInfo.Name := "Calendar dictionary";

CrInfo.Parent := MB.Root;

MObj := MB.CreateObject(CrInfo).Edit;

Calendar := MObj As ICalendarDimension;

//Calendar period

Calendar.StartYear := 1990;

Calendar.EndYear := 2010;

//Calendar type

Calendar.Hierarchy := 3;

//Levels

Calendar.IncludeDays := True;

Calendar.IncludeWeek := True;

Calendar.IncludeMonths := True;

Calendar.IncludeYears := True;

Calendar.LastLevelNameAsDay := True;

Calendar.WeekLevel.RestDays := DayOfWeekSet.Saturday Or DayOfWeekSet.Sunday;

//Custom attribute

CalAttr := Calendar.Attributes.Add;

CalAttr.Name := "Date";

CalAttr.Expression(-1).AsString := "@[d MMMM yyyy]+"" y. (""+@[ddd]+"")""";

MObj.Save;

End Sub Main;

After executing the example a calendar dictionary is created in the repository root. Dictionary period: 1990-2010. Dictionary hierarchy includes the following levels: Day, Week, Month, Year. A week has 5 days. Name of the last level is replaced with the day displayed in the 01.01.1990 format. A custom attribute is also created displaying date at all levels as January, 1, 1990. (Mon).

See also:

ICalendarDimension