InheritModelPeriod: Boolean;
InheritModelPeriod: boolean;
The InheritModelPeriod property determines whether the chain element inherits calculation period and frequency from 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 MODELLING_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 the model is added to the metamodel chain. This folder is regarded as a group. The period and calculation frequency are assigned for it. The model that is placed in the folder inherits the period and calculation frequency of the folder.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
Metabase: IMetabase;
ModelspaceDescr: IMetabaseObjectDescriptor;
MetaModel: IMsMetaModel;
CalculationChain, FolderCont: IMsCalculationChainEntries;
Folder: IMsCalculationChainFolder;
Period: IMsModelPeriod;
Model: IMsModel;
CalcModel: IMsCalculationChainModel;
Begin
Metabase := Params.Metabase;
// 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("Source data");
// Set parameters of folder calculation
Folder.Level := DimCalendarLevel.dclYear;
Period := Folder.Period;
Period.ForecastEndDate := DateTime.Parse("2019.12.31");
Period.ForecastStartDate := DateTime.Parse("2010.1.1");
Period.IdentificationEndDate := DateTime.Parse("2009.12.31");
Period.IdentificationStartDate := DateTime.Parse("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;
See also: