Variable(Stub: IVariableStub): IMatrix;
Stub. Model of the variable, data of which needs to be obtained.
The Variable property returns the matrix with variable data, which structure is passed by the parameter Stub. This property is used at model calculation by the custom method.
Public Class My_Method: Object, IMsUserTransformImplementation
Matr: IMatrix;
Mcoo: IMatrixCoord;
Cub: ICubeInstance;
Sub Execute(Calculation: IMsMethodCalculation; Coo: IMsFormulaTransformCoord;
Explained: IMsFormulaTerm; Explanatories: IMsFormulaTermList);
Var
i: Integer;
Begin
Matr := Calculation.Variable(Explained.Slice.Variable.VariableStub);
Mcoo := Matr.CreateCoord;
Matr.ValueFlag := Matr.ValueFlag + 1;
For i := 0 To Calculation.Period.ForecastEndDate.Year - Calculation.Period.IdentificationStartDate.Year Do
MCoo.Item(0) := i;
MCoo.Item(1) := 1;
Matr.Item(Mcoo) := Calculation.CurrentPoint.Year;
Calculation.CurrentPoint := DateTime.AddYears(Calculation.CurrentPoint, 1);
End For;
Cub := (Explained.Slice.Variable.VariableStub As IMetabaseObject).Open(Null) As ICubeInstance;
Cub.Destinations.DefaultDestination.CreateStorage.SaveMatrix(Matr, Matr.ValueFlag);
End Sub Execute;
End Class My_Method;
This example is a macro that contains a user method of model calculation. At model calculation that has been adjusted to use the custom method, on the first script dimension the values of year in a point of calculation are recorded.
See also:
IMsMethodCalculation|IMsUserTransform|IMsUserTransform.Assembly|IMsUserTransform.ClassName