ITsCalculationContext.VariableMatrix

Syntax

VariableMatrix(Stub: IVariableStub): IMatrixDataSource;

Parameters

Stub. Abstract data source.

Description

The VariableMatrix property restores access to the specified data source.

Comments

For validation rules the VariableMatrix property always returns Null.

Example

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.

See also:

ITsCalculationContext