FactsMatrix(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): Array;
Calculation. Model calculation options.
Coord. The model slice, by which calculation is executed.
The FactsMatrix property returns the array containing model factors values.
The Calculation and Coord parameters cannot take the Null value.
The array that contains the factors correlation is returned by the IMsDeterministicTransform.PairCorrelationMatrix property.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains a determinate equation model with the MODELDETERM identifier.
Add links to the Matrix, Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
hModel: IMetabaseObjectDescriptor;
oModel: IMsModel;
trans: IMsFormulaTransform;
selector: IMsFormulaTransformSelector;
formula: IMsFormula;
output: IMsFormulaTransformVariable;
determ: IMsDeterministicTransform;
coord: IMsFormulaTransformCoord;
calculation: IMsMethodCalculation;
calcPeriod, modPeriod: IMsModelPeriod;
matrix: Array Of Double;
i, j: Integer;
nFactors: Integer;
Begin
mb := metabaseClass.Active;
MsKey : = mb.ItemById("MS").Key;
hModel := mb.ItemByIdNamespace("MODEL_DETERM", MsKey);
oModel := hModel.Bind As IMsModel;
trans := oModel.Transform;
output := trans.Outputs.Item(0);
selector := trans.CreateSelector;
selector.Slice := output.Slices.Item(0);
formula := trans.Transform(selector);
determ := formula.Method As IMsDeterministicTransform;
coord := trans.CreateCoord(output);
calculation := trans.CreateCalculation;
calcPeriod := calculation.Period;
modPeriod := oModel.Period;
calcPeriod.ForecastEndDate := modPeriod.ForecastEndDate;
calcPeriod.ForecastStartDate := modPeriod.ForecastStartDate;
calcPeriod.IdentificationEndDate := modPeriod.IdentificationEndDate;
calcPeriod.IdentificationStartDate := modPeriod.IdentificationStartDate;
matrix := determ.FactsMatrix(calculation, coord);
nFactors := determ.Operands.Count;
For i := 0 To nFactors - 1 Do
Debug.WriteLine(Factor: + determ.Operands.Item(i).TermToText + . Values:);
For j := matrix.GetLowerBound(1) To matrix.GetUpperBound(1) Do
Debug.WriteLine(" " + matrix[j, i].ToString);
End For;
End For;
End Sub UserProc;
After executing the example the console window displays names and values of model factors.
See also: