ICalendarDimAttribute.Format

Syntax

Format(LevelIndex: Integer): String;

Parameters

LevelIndex. Index of the level for which you need to define format of element names.

Description

The Format property determines format of attribute values for selected dictionary level.

NOTE. This property is ignored if there is an expression based on which names of level elements are formed. This expression is defined in the ICalendarDimAttribute.Expression property.

Comments

Format is set for specific dictionary level, index of which is passed in the LevelIndex parameter. Use the CalendarLevelIndex property to get dictionary index.

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. Use codes listed in the table to generate format.

Example

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

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    CalDim: ICalendarDimension;
    UserAttrs: ICalendarDimAttributes;
    UserAttr: ICalendarDimAttribute;
    LevInd: Integer;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("D_CALENDAR").Edit;
    CalDim := MObj As ICalendarDimension;
    UserAttrs := CalDim.Attributes;
    UserAttrs.Clear;
    UserAttr := UserAttrs.Add;
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Root);
    UserAttr.Format(LevInd) := "Calendar";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Year);
    UserAttr.Format(LevInd) := "Year/YY";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.HalfYear);
    UserAttr.Format(LevInd) := "SA-th half-year";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Quarter);
    UserAttr.Format(LevInd) := "QA-th quarter";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Month);
    UserAttr.Format(LevInd) := "ML-th month";
    LevInd := CalDim.CalendarLevelIndex(DimCalendarLevel.Day);
    UserAttr.Format(LevInd) := "Day: DD";
    UserAttrs.Name := UserAttr;
    MObj.Save;
End Sub UserProc;

After executing the example a new custom attribute is added to the calendar dictionary. This attribute is assigned as a element name attribute. Elements of all levels are displayed with names of various formats (left) that differ from the standard ones (right):

See also:

ICalendarDimAttribute