ICalendarDimension.Hierarchy

Syntax

Hierarchy: Integer;

Description

The Hierarchy property determines type of calendar hierarchy.

Comments

The following values are used to specify dictionary type:

Value Calendar type
0 Years – Half-years – Quarters – Months – Days.
1 Years – (Half-years – Quarters – 9 months) – Months – Days.
2 Years – (Half-years – 9 months) – Quarters – Months – Days.
3 Years – Half-years – Quarters – Months – Weeks – Days.

The Root level is always available regardless of hierarchy type. A single element is used as root at this level. Name of this element matches name of the calendar dictionary, its identifier is Root.

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;

//Replace names of the last level elements with day displayed in "01.01.1990" format.

Calendar.LastLevelNameAsDay := True;

//Non-business days

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