Result: IMsFormulaTerm;
The Result property returns the term corresponding to output variable.
Executing the example requires that the repository contains a modeling container with the MS_DEFAULT identifier containing an aggregation model with the MODEL_AGGREGATION identifier.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Model: IMsModel;
ModelTrans: IMsFormulaTransform;
Formula: IMsFormula;
Agrr: IMsAggregationTransform;
Coord: IMsFormulaTransformCoord;
Calc: IMsModelCalculation;
Arr: Array Of Double;
i: Integer;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get modeling container
MObj := MB.ItemById("MS_DEFAULT");
// Get aggregation model
Model := MB.ItemByIdNamespace("MODEL_AGGREGATION", MObj.Key).Bind As IMsModel;
ModelTrans := Model.Transform;
Formula := ModelTrans.FormulaItem(0);
// Get model calculation parameters
Agrr := Formula.Method As IMsAggregationTransform;
// Determine settings to calculate model
Coord := ModelTrans.CreateCoord(ModelTrans.Outputs.Item(0));
Calc := Model.CreateCalculation;
Calc.Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
Calc.Period.IdentificationEndDate := DateTime.Parse("31.12.2016");
Calc.Period.ForecastStartDate := DateTime.Parse("01.01.2017");
Calc.Period.ForecastEndDate := DateTime.Parse("31.12.2025");
// Get output variable data and display it in the console window
Arr := Agrr.Result.Serie(Calc As IMsMethodCalculation);
For i := 0 To Arr.Length - 1 Do
Debug.WriteLine(Arr[i]);
End For;
End Sub UserProc;
After executing the example the console window displays output variable data.
See also: