CalculationType: MsCalculationType;
CalculationType: Prognoz.Platform.Interop.Ms.MsCalculationType;
The CalculationType property determines a mode of calculation of 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 executed by the transformation problem.
NOTE. If the group uses parameters, dynamic changes are not taken into account on calculation.
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 calculation chain
CalculationChain.Clear;
// Add a folder to calculation chain
Folder := CalculationChain.AddFolder("Source data");
// Set calendar level to calculate folder
Folder.Level := DimCalendarLevel.Year;
// Set calculation period of 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 mode of folder calculation
Folder.CalculationType := MsCalculationType.Pointwise;
// Form folder contents
FolderCont := Folder.Contents;
// Get model
Model := Metabase.ItemByIdNamespace("MODEL", ModelspaceDescr.Key).Bind As IMsModel;
// Add model to folder
CalcModel := FolderCont.AddModel(Model);
// Specify that model inherits parameters of calculation period from folder
CalcModel.InheritModelPeriod := True;
// Save changes
(MetaModel As IMetabaseObject).Save;
End Sub UserProc;
Example execution result: the folder, which contains metamodel is 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 calculation chain
CalculationChain.Clear();
// Add folder to calculation chain
Folder := CalculationChain.AddFolder("Source data");
// Set calendar level to calculate folder
Folder.Level := DimCalendarLevel.dclYear;
// Set calculation period of 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 mode of folder calculation
Folder.CalculationType := MsCalculationType.mctPointwise;
// Form folder contents
FolderCont := Folder.Contents;
// Get model
Model := Metabase.ItemByIdNamespace["MODEL", ModelspaceDescr.Key].Bind() As IMsModel;
// Add model to folder
CalcModel := FolderCont.AddModel(Model);
// Specify that model inherits parameters of calculation period from folder
CalcModel.InheritModelPeriod := True;
// Save changes
(MetaModel As IMetabaseObject).Save();
End Sub;
See also: