Values(Index: Integer): Variant;
Values[Index: integer]: object;
Index. Attribute index that is used to store matrix element value.
The Values property determines value of the specified attribute for the matrix element, on which the iterator cursor is currently put.
The property is relevant on working the factors (IRubricatorExecuteResult.Factors) or the values (IRubricatorExecuteResult.Values) with matrix, which can be obtained after time series database calculation. If the IRubricatorFactorIO.FactDataId/IRubricatorFactorIO.ValueId properties are not set on calculation, the IRubricatorExecuteResult.Factors factor output matrix will have empty values, and the IRubricatorExecuteResult.Values value output matrix will contain factor values (values of the VL attribute). The values can be determined using the IMatrixModelIterator.Value property.
If the IRubricatorFactorIO.FactDataId/IRubricatorFactorIO.ValueId properties are set, after calculation each cell of output matrix provides value set of the specified attributes. The ValueCount property returns the number of attribute values in each matrix cell (corresponds to the number of attributes specified in the IRubricatorFactorIO.FactDataId/IRubricatorFactorIO.ValueId properties). Value of each attribute can be obtained via the Values property.
Executing the example requires that the repository contains a time series database with the TSBD identifier.
Sub UserProc;
Var
MB: IMetabase;
RubInst: IRubricatorInstance;
Cube: ICubeInstance;
Dest: ICubeInstanceDestination;
Exec: ICubeInstanceDestinationExecutor;
Matr, DataMatr: IMatrix;
Iterator: IMatrixIterator;
i: Integer;
Begin
MB := MetabaseClass.Active;
RubInst := MB.ItemById("TSDB").Open(Null) As IRubricatorInstance;
Cube := RubInst As ICubeInstance;
Dest := Cube.Destinations.DefaultDestination;
Exec := Dest.CreateExecutor;
//Factor attributes
(Exec As IRubricatorFactorIO).FactDataId := "FACTOR;MNEMO";
//Observation attributes
(Exec As IRubricatorFactorIO).ValueId := "FACTOR;VL";
Exec.PrepareExecute(Null);
Exec.PerformExecute;
Matr := Exec.Matrix;
//Factor matrix
Debug.WriteLine("Information about factors:");
DataMatr := (CubeClass.ExecuteResult(Matr) As IRubricatorExecuteResult).Factors;
Iterator := DataMatr.CreateIterator;
Iterator.Move(IteratorDirection.First);
While Iterator.Valid Do
For i := 0 To Matr.ValueCount - 1 Do
Select Case i
Case 0: Debug.Write("Factor: ");
Case 1: Debug.Write(" Mnemonic: ");
End Select;
Debug.Write(Iterator.Values(i) + ".");
End For;
Debug.WriteLine("");
Iterator.Move(IteratorDirection.Next);
End While;
//Value matrix
Debug.WriteLine("Information about factor values:");
DataMatr := (CubeClass.ExecuteResult(Matr) As IRubricatorExecuteResult).Values;
Iterator := DataMatr.CreateIterator;
Iterator.Move(IteratorDirection.First);
While Iterator.Valid Do
For i := 0 To Matr.ValueCount - 1 Do
Select Case i
Case 0: Debug.Write("Factor: ");
Case 1: Debug.Write(" Value: ");
End Select;
Debug.Write(Iterator.Values(i) + ".");
End For;
Debug.WriteLine("");
Iterator.Move(IteratorDirection.Next);
End While;
End Sub UserProc;
On executing the example time series database is calculated. After the calculation, factor matrix and value matrix are obtained. The key (the FACTOR attribute values) and the mnemonic (the MNEMO attribute values) are obtained. The factor key (the FACTOR attribute values) and the value (the VL attribute values) will be available in each matrix cell. All values will be displayed in the development environment console.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RubInst: IRubricatorInstance;
Cube: ICubeInstance;
CubeClassCls: CubeClass = New CubeClassClass();
Dest: ICubeInstanceDestination;
Exec: ICubeInstanceDestinationExecutor;
Matr, DataMatr: IMatrix;
Iterator: IMatrixIterator;
i: Integer;
Begin
MB := Params.Metabase;
RubInst := MB.ItemById["TSDB"].Open(Null) As IRubricatorInstance;
Cube := RubInst As ICubeInstance;
Dest := Cube.Destinations.DefaultDestination;
Exec := Dest.CreateExecutor();
//Factor attributes
(Exec As IRubricatorFactorIO).FactDataId := "FACTOR;DL;MNEMO";
//Observation attributes
(Exec As IRubricatorFactorIO).ValueId := "FACTOR;VL";
Exec.PrepareExecute(Null);
Exec.PerformExecute(False);
Matr := Exec.Matrix;
//Factor matrix
System.Diagnostics.Debug.WriteLine("Information about factors:");
DataMatr := (CubeClassCls.ExecuteResult[Matr] As IRubricatorExecuteResult).Factors;
Iterator := DataMatr.CreateIterator();
Iterator.Move(IteratorDirection.itdFirst);
While Iterator.Valid Do
For i := 0 To Matr.ValueCount - 1 Do
Select Case i
Case 0: System.Diagnostics.Debug.Write("Factor: ");
Case 1: System.Diagnostics.Debug.Write(" Mnemonic: ");
End Select;
System.Diagnostics.Debug.Write(Iterator.Values[i] + ".");
End For;
System.Diagnostics.Debug.WriteLine("");
Iterator.Move(IteratorDirection.itdNext);
End While;
//Value matrix
System.Diagnostics.Debug.WriteLine("Information about factor values:");
DataMatr := (CubeClassCls.ExecuteResult[Matr] As IRubricatorExecuteResult).Values;
Iterator := DataMatr.CreateIterator();
Iterator.Move(IteratorDirection.itdFirst);
While Iterator.Valid Do
For i := 0 To Matr.ValueCount - 1 Do
Select Case i
Case 0: System.Diagnostics.Debug.Write("Factor: ");
Case 1: System.Diagnostics.Debug.Write(" Value: ");
End Select;
System.Diagnostics.Debug.Write(Iterator.Values[i] + ".");
End For;
System.Diagnostics.Debug.WriteLine("");
Iterator.Move(IteratorDirection.itdNext);
End While;
End Sub;
See also: