ICalendarDimension.AttributeIndex

Syntax

AttributeIndex(AttrNumber: Integer): Integer;

Parameters

AttrNumber. Sequence number of attribute used for dictionary creation.

Description

The AttributeIndex property returns reserved index of a standard attribute by its number in the list of attributes used for dictionary creation.

Comments

A number of standard attributes can be used for calendar dictionaries:

Reserved attribute index Attribute identifier. Attribute name
0 NAME Calendar element name.
1 START_DATE Start date of the period.
2 FINISH_DATE End date of the period.
3 BLOCK_TYPE Dictionary block type.
4 LEVEL_TYPE Type of dictionary level.
5 BLOCK_NAME Name of dictionary block.
6 LEVEL_NAME Name of dictionary level.
7 ORDER Order.
8 ID Identifier.
9 PERIOD Period.
10 YEAR Year number.
11 HALF_OF_YEAR Half-year number.
12 QUARTER Quarter number.
13 MONTH Month number.
14 WEEK_OF_YEAR Number of a week in a year.
15 DAY_OF_WEEK Number of a day in a week.
16 DAY_OF_MONTH Number of a day in a month.
17 DAY_OF_YEAR Number of a day in a year.

Every attribute has reserved index, that is used for extension of attribute list, values for which are calculated while building a dictionary. This property is used to compare:

Attribute number in the list  → Reserved attribute index in the collection of dictionary attributes

NOTE. When the dictionary is opened from the object navigator, the Name of Calendar Element attribute is always displayed first. A tree of dictionary elements is to be formed from values of this attribute.

An exception is thrown if the passed number does not match standard attribute.

Example

Executing the example assumes that the repository contains a calendar dictionary with the CALENDAR_DIM identifier.

Sub Main;

Var

MB: IMetabase;

CalDim: ICalendarDimension;

i: Integer;

Begin

MB := MetabaseClass.Active;

CalDim := MB.ItemById("CALENDAR_DIM").Bind As ICalendarDimension;

For i := 0 To CalDim.AttributeCount - 1 Do

Select Case CalDim.AttributeIndex(i)

Case 0: Debug.WriteLine("Name of dictionary element");

Case 1: Debug.WriteLine("Start date of the period");

Case 2: Debug.WriteLine("End date of the period");

Case 3: Debug.WriteLine("Dictionary block type");

Case 4: Debug.WriteLine("Type of dictionary level");

Case 5: Debug.WriteLine("Name of dictionary block");

Case 6: Debug.WriteLine("Name of dictionary level");

Case 7: Debug.WriteLine("Order");

Case 8: Debug.WriteLine("Identifier");

End Select;

End For;

End Sub Main;

After executing the example the development environment console shows named of standard calendar dictionary attributes in the order of their creation in the dictionary.

See also:

ICalendarDimension