Expression(LevelIndex: Integer): IExpression;
LevelIndex. Index of the level for which you need to get the expression.
The Expression property returns expression based on which attribute values are formed.
Expression is returned for a specific dictionary level index of which is passed in the parameter LevelIndex. Use the CalendarLevelIndex property to get dictionary index. To get the expression used for all levels, pass -1 as value of the parameter LevelIndex.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
CalDim: ICalendarDimension;
UserAttrs: ICalendarDimAttributes;
UserAttr: ICalendarDimAttribute;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("CALENDAR_DIM").Edit;
CalDim := MObj As ICalendarDimension;
UserAttrs := CalDim.Attributes;
UserAttr := UserAttrs.Add;
UserAttr.Expression(-1).AsString := #34 + "Level element " + #34 + "+LEVEL";
UserAttrs.Name := UserAttr;
MObj.Save;
End Sub Main;
After executing the example a new custom attribute is added to calendar dictionary, and the same expression is set for elements of all levels. On creating the dictionary element names will be based on this attribute.
See also: