VariableStub: IVariableStub;
The VariableStub property returns the object containing the structure of variable dimensions.
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: