Dimension(Index: Integer): IDimInstance;
Index. Index of additional dimension.
The Dimension property returns the data of additional dimension, the index of which is passed by the parameter Index.
Executing the example requires that the modeling container includes the model, that uses the method of linear regression for calculation. The output variable contains one additional dimension.
Sub Main;
Var
MB: IMetabase;
Model: IMsModel;
Transform: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
LinReg: IMsLinearRegressionTransform;
Coord: IMsFormulaTransformCoord;
Calc: IMsModelCalculation;
i: Integer;
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.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);
i := Coord.Dimension(0).Attributes.Item(0).LookupValue(Bryansk Region);
If i <> -1 Then
Coord.Item(0) := i;
LinReg.Identify(Calc As IMsMethodCalculation, Coord);
Debug.WriteLine(LinReg.Summary(Coord).R2.ToString);
End If;
End Sub Main;
After executing the example, the search is performed by the first attribute of the Bryansk Region value in data of the first additional dimension of the variable; in case the search is successful, factors of the model equation are identified by the given element.
See also: