CalculationType: MsCalculationType;
CalculationType: Prognoz.Platform.Interop.Ms.MsCalculationType;
The CalculationType property determines the mode of calculation of the group.
By default the group is calculated in the series mode, that is CalculationType=MsCalculationType.Serie.
The property is relevant if the calculation of the group is performed by the transformation problem.
NOTE. If the group uses parameters then on calculating the dynamic changes are not taken into account.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. This container contains a metamodel with the METAMODEL identifier and a model with the MODEL identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub UserProc;
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("MODEL_SPACE");
// Get metamodel
MetaModel := Metabase.ItemByIdNamespace("METAMODEL", ModelspaceDescr.Key).Edit As IMsMetaModel;
// Get metamodel calculation chain
CalculationChain := MetaModel.CalculationChain;
// Clear the calculation chain
CalculationChain.Clear;
// Add the folder to the calculation chain
Folder := CalculationChain.AddFolder("Source data");
// Set the calendar level to calculate the folder
Folder.Level := DimCalendarLevel.Year;
// Set the calculation period of the folder
Period := Folder.Period;
Period.ForecastEndDate := DateTime.Parse("01.01.2015");
Period.ForecastStartDate := DateTime.Parse("01.01.2010");
Period.IdentificationEndDate := DateTime.Parse("31.12.2009");
Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
// Set the mode of folder calculation
Folder.CalculationType := MsCalculationType.Pointwise;
// Form folder content
FolderCont := Folder.Contents;
// Get the model
Model := Metabase.ItemByIdNamespace("MODEL", ModelspaceDescr.Key).Bind As IMsModel;
// Add model to the folder
CalcModel := FolderCont.AddModel(Model);
// Specify that the model inherits the parameters of the calculation period from folder
CalcModel.InheritModelPeriod := True;
// Save changes
(MetaModel As IMetabaseObject).Save;
End Sub UserProc;
Example execution result: The folder which contain metamodel will be added to the metamodel chain. The folder is a group of elements and the following will be set for it: calendar level and calculation period, calculation mode. The model which is contained in the folder inherits the calendar level and the folder calculation period.
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["MODEL_SPACE"];
// Get metamodel
MetaModel := Metabase.ItemByIdNamespace["METAMODEL", ModelspaceDescr.Key].Edit() As IMsMetaModel;
// Get metamodel calculation chain
CalculationChain := MetaModel.CalculationChain;
// Clear the calculation chain
CalculationChain.Clear();
// Add the folder to the calculation chain
Folder := CalculationChain.AddFolder("Source data");
// Set the calendar level to calculate the folder
Folder.Level := DimCalendarLevel.dclYear;
// Set the calculation period of the folder
Period := Folder.Period;
Period.ForecastEndDate := DateTime.Parse("01.01.2015");
Period.ForecastStartDate := DateTime.Parse("01.01.2010");
Period.IdentificationEndDate := DateTime.Parse("31.12.2009");
Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
// Set the mode of folder calculation
Folder.CalculationType := MsCalculationType.mctPointwise;
// Form folder content
FolderCont := Folder.Contents;
// Get the model
Model := Metabase.ItemByIdNamespace["MODEL", ModelspaceDescr.Key].Bind() As IMsModel;
// Add model to the folder
CalcModel := FolderCont.AddModel(Model);
// Specify that the model inherits the parameters of the calculation period from folder
CalcModel.InheritModelPeriod := True;
// Save changes
(MetaModel As IMetabaseObject).Save();
End Sub;
See also: