IsCalendar: Boolean;
IsCalendar: Boolean;
The IsCalendar property determines whether dictionary is used as a calendar one.
To define a dictionary as a calendar one, the following attributes are required:
BLOCK_TYPE;
START_DATE;
NAME;
ID;
ORDER.
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;
// Compare 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;
// Compare 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.
The example is analogous to the Fore Example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Dimensions;
Sub UserProc(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dim: IDimensionModel;
DimAsCln: IDimAsCalendar;
sAttr: String;
pAttr: IDimAttribute;
eLevel: DimCalendarLevel;
I: Integer;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["OBJ12514"].Edit();
Dim := MObj As IDimensionModel;
DimAsCln := Dim.AsCalendar;
// Compare 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;
End For;
// Compare levels
For I := 0 To DimAsCln.Levels.Count - 1 Do
eLevel := DimAsCln.Levels.Item[I].Level;
DimAsCln.Levels.LevelKey[eLevel] := 100 + (eLevel As Integer);
End For;
// Define dictionary as a calendar one
Dim.IsCalendar := True;
MObj.Save();
End Sub UserProc;
See also: