InheritModelPeriod: Boolean;
The InheritModelPeriod property determines whether the chain element inherits period and calculation frequency of the parent element.
Available values:
True. The chain element inherits calculation period and frequency from the parent element. If the parent element also inherits a period, the period is taken from the higher level element, up to the problem calculation period.
False. Default value. Each element of the chain uses its own period and calculation frequency. If the period or calculation frequency are not set, they are inherited from the parent element.
Executing the example requires that the repository contains a modeling container with the MODELING_CONTAINER identifier. This container contains a metamodel with the META_MODEL identifier and a model with the MODEL identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub UserInherit;
Var
Metabase: IMetabase;
ModelspaceDescr: IMetabaseObjectDescriptor;
MetaModel: IMsMetaModel;
CalculationChain, FolderCont: IMsCalculationChainEntries;
Folder: IMsCalculationChainFolder;
Period: IMsModelPeriod;
Model: IMsModel;
CalcModel: IMsCalculationChainModel;
Begin
Metabase := MetabaseClass.Active;
// Get modeling container
ModelspaceDescr := Metabase.ItemById("MODELING_CONTAINER");
// Get metamodel
MetaModel := Metabase.ItemByIdNamespace("META_MODEL", ModelspaceDescr.Key).Edit As IMsMetaModel;
// Get calculation chain and create a folder in it
CalculationChain := MetaModel.CalculationChain;
Folder := CalculationChain.AddFolder("Initial data");
// Set parameters of folder calculation
Folder.Level := DimCalendarLevel.Year;
Period := Folder.Period;
Period.ForecastEndDate := DateTime.ComposeDay(2019, 12, 31);
Period.ForecastStartDate := DateTime.ComposeDay(2010, 1, 1);
Period.IdentificationEndDate := DateTime.ComposeDay(2009, 12, 31);
Period.IdentificationStartDate := DateTime.ComposeDay(2000, 1, 1);
FolderCont := Folder.Contents;
// Get model
Model := Metabase.ItemByIdNamespace("MODEL", ModelspaceDescr.Key).Bind As IMsModel;
// Add a model to folder
CalcModel := FolderCont.AddModel(Model);
// Specify that model inherits period and calculation frequency from folder
CalcModel.InheritModelPeriod := True;
// Save changes
(MetaModel As IMetabaseObject).Save;
End Sub UserInherit;
After executing the example, the folder that contains a metamodel is added to the metamodel chain. This folder is regarded as a group. A period and calculation frequency are set for it. The model that is located in the folder inherits the period and calculation frequency of the folder.
See also: