IMsFormulaTransform.CreateCalculation

Syntax

CreateCalculation: IMsMethodCalculation;

Description

The CreateCalculation method creates an object determining the parameters required for model calculation by the selected method.

Example

Executing the example requires a modeling container with the KONT_MODEL identifier. The model with the Model_1 identifier must be present in this container.

Sub Main;

Var

MB: IMetabase;

Model: IMsModel;

Transform: IMsFormulaTransform;

VarTrans: IMsFormulaTransformVariable;

Tree: IMsFormulaTransformSlicesTree;

Slice: IMsFormulaTransformSlice;

Selector: IMsFormulaTransformSelector;

Formula: IMsFormula;

LinReg: IMsLinearRegressionTransform;

Coord: IMsFormulaTransformCoord;

Calc: IMsMethodCalculation;

CalcRes: IMsModelCalculationResult;

Begin

MB := MetabaseClass.Active;

Model := MB.ItemByIdNamespace("Model_1", MB.ItemById("KONT_MODEL").Key).Bind As IMsModel;

Transform := Model.Transform;

VarTrans := Transform.Outputs.Item(0);

Tree := VarTrans.SlicesTree(VarTrans);

Slice := Tree.CreateSlice(1);

Selector := Model.Output.Item(0).Transform.CreateSelector;

Selector.Slice := Slice;

Formula := Model.Transform.Transform(Selector);

LinReg := Formula.Method As IMsLinearRegressionTransform;

Coord := Model.Transform.CreateCoord(VarTrans);

Calc := Model.Transform.CreateCalculation;

Calc.Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);

Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2007, 12, 31);

Calc.Period.ForecastStartDate := DateTime.ComposeDay(2008, 01, 01);

Calc.Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);

CalcRes := LinReg.Execute(Calc, Coord);

End Sub Main;

After executing the example the model with Model_1 identifier will be calculated. Calculation is made by the Fact dimension of the output variable. If the variable has the additional dimensions, the calculation is performed by the first elements of these dimensions.

See also:

IMsFormulaTransform