VariableMatrix(Stub: IVariableStub): IMatrixDataSource;
VariableMatrix(Stub: Prognoz.Platform.Interop.Cubes.IVariableStub): Prognoz.Platform.Interop.Matrix.IMatrixDataSource;
Stub. Abstract data source.
The property is read-only.
The VariableMatrix property enables the user to get access to the specified data source.
For validation rules the VariableMatrix property always returns Null.
This example displays a custom method used for series calculation mode. Executing the example requires a modeling variable with the 13418 key.
Add links to the Metabase, Ms, Transform, Matrix, Cubes system assemblies.
Public Function CopyData: Variant;
Var
pContext: ITsCalculationContext;
i: Integer;
pSeries: ITimeSeries;
mb: IMetabase;
VarStub: IVariableStub;
MatrixDS: IMatrixDataSource;
Matr: IMatrix;
MatrIter: IMatrixIterator;
Begin
pContext := TsCalculation.Current;
pSeries := pContext.CreateTimeSeries;
If pContext.CalculationType = TsCalculationType.Series Then
mb := MetabaseClass.Active;
VarStub := mb.Item(13418).Bind As IVariableStub;
MatrixDS := pContext.VariableMatrix(VarStub);
Matr := MatrixDS.Execute(Null);
MatrIter := Matr.CreateIterator;
MatrIter.Move(IteratorDirection.First);
For i := pSeries.StartIndex To pSeries.EndIndex Do
pSeries.Item(i) := MatrIter.Value;
MatrIter.Move(IteratorDirection.Next);
End For;
Return pSeries;
End If;
End Function CopyData;
The method copies data from the variable with the 13418 key.
This example displays a custom method used for series calculation mode. Executing the example requires a modeling variable with the 13418 key.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Transform;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Function CopyData(Params: StartParams): object;
Var
TsCalc: TsCalculation;
pContext: ITsCalculationContext;
i: Integer;
pSeries: ITimeSeries;
mb: IMetabase;
VarStub: IVariableStub;
MatrixDS: IMatrixDataSource;
Matr: IMatrix;
MatrIter: IMatrixIterator;
Begin
TsCalc := New TsCalculation.Create();
pContext := TsCalc.Current[Null];
pSeries := pContext.CreateTimeSeries(-1 As DimCalendarLevel, Null) As ITimeSeries;
If pContext.CalculationType[Null] = TsCalculationType.tctSeries Then
mb := Params.Metabase;
VarStub := mb.Item[13418].Bind() As IVariableStub;
MatrixDS := pContext.VariableMatrix[VarStub];
Matr := MatrixDS.Execute(Null);
MatrIter := Matr.CreateIterator();
MatrIter.Move(IteratorDirection.itdFirst);
For i := pSeries.StartIndex To pSeries.EndIndex Do
pSeries.Item[i] := MatrIter.Value;
MatrIter.Move(IteratorDirection.itdNext);
End For;
End If;
Return pSeries;
End Function;
The method copies data from the variable with the 13418 key.
See also: