ICalendarDimension.NameAttrFormat

Syntax

NameAttrFormat(LevelIndex: Integer): String;

Parameters

LevelIndex - index of the level for which you need to define format of displaying element names.

Description

The NameAttrFormat property determines format of displaying elements names for selected level. Format string consists of format elements. Each element returns a part of value, this can be a month. Basic available format elements are described in the table below:

Format element Brief description
DD Day of month (01 - 31).
WW Number of week in Arabic numerals (1 - n).
ML Number of month in Roman numerals (I - XII).
MM (MA) Number of month in Arabic numerals (1 - 12).
Mon Abbreviated names of the months (Jan - Dec).
QL Number of quarter in Roman numerals (I - IV).
QA Number of quarter in Arabic numerals (1 - 4).
SL Number of half-year in Roman numerals (I, II).
SA Number of half-year in Arabic numerals (1, 2).
YY Two last digits of the year.
YYYY Year in four-digit format.

Any words or characters can be also used in the template. For example: "SA half-year".

NOTE. Format elements are case-sensitive. When setting format use codes listed in the table.

Example

Executing the example requires that the repository contains a calendar dictionary with the D_CALENDAR identifier.

Sub Main;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    CalDim: ICalendarDimension;
    LevInd: Integer;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("D_CALENDAR").Edit;
    CalDim := MObj As ICalendarDimension;
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Year);
    CalDim.NameAttrFormat(LevInd) := "Year: YYYY";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.HalfYear);
    CalDim.NameAttrFormat(LevInd) := "SA-th half-year YYYY";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Quarter);
    CalDim.NameAttrFormat(LevInd) := "QA-th quarter YYYY";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Month);
    CalDim.NameAttrFormat(LevInd) := "Month: ML";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Day);
    CalDim.NameAttrFormat(LevInd) := "DD-th day of MA-th month";
    MObj.Save;
End Sub Main;

After executing the example various formats of displaying element names are set for calendar dictionary at different levels (left), which differ from the standard ones (right):

See also:

ICalendarDimension