IsCalendar: Boolean;
The IsCalendar property determines whether dictionary is used as a calendar one.
To determine a dictionary as a calendar one, one should create a primary index with the following order of mandatory attributes: the first attribute - BLOCK_TYPE, the second attribute - START_DATE, and also NAME, ID, and ORDER. This index should be the first one in the list of dictionary indexes.
To compare attributes, pass the required set of attributes and levels to the IDimensionModel.AsCalendar property.
Executing the example requires a table dictionary containing the attributes:
BLOCK_TYPE_REN;
START_DATE_REN;
NAME_REN;
ID_REN;
ORDER_REN.
Add links to the Metabase and Dimensions system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dim: IDimensionModel;
DimAsCln: IDimAsCalendar;
sAttr: String;
pAttr: IDimAttribute;
eLevel: DimCalendarLevel;
I: Integer;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("OBJ12514").Edit;
Dim := MObj As IDimensionModel;
DimAsCln := Dim.AsCalendar;
// Map attributes
For I := 0 To DimAsCln.Attrs.Count - 1 Do
sAttr := DimAsCln.Attrs.Item(I).Id;
pAttr := Dim.Attributes.FindById(sAttr + "_REN");
DimAsCln.Attrs.IdAttr(sAttr) := pAttr;
// Output identifiers of attributes to the console
debug.WriteLine(DimAsCln.Attrs.Item(I).Attr.Id);
End For;
// Map levels
For I := 0 To DimAsCln.Levels.Count - 1 Do
eLevel := DimAsCln.Levels.Item(I).Level;
DimAsCln.Levels.LevelKey(eLevel) := 100 + (eLevel As Integer);
// Output keys of levels to the console
debug.WriteLine(DimAsCln.Levels.Item(I).Key);
End For;
// Define dictionary as a calendar one
Dim.IsCalendar := True;
MObj.Save;
End Sub UserProc;
After executing the example dictionary attributes are compared, and the dictionary is defined as a calendar one.
See also: