CreateExecutorO(Options: Integer): ICubeInstanceDestinationExecutor;
CreateExecutorO(Options: integer): Prognoz.Platform.Interop.Cubes.ICubeInstanceDestinationExecutor;
Options. Cube calculation parameters.
The CreateExecutorO method creates an object that calculates output cube matrix with the use of parameters.
Executing the example requires that the repository contains a cube with the CUBE identifier.
Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CubeInst: ICubeInstance;
DefDest: ICubeInstanceDestination;
SelSet: IDimSelectionSet;
i: integer;
DestExec: ICubeInstanceDestinationExecutor;
Proxy: IMatrix;
Iter: IMatrixIterator;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemById("CUBE").Open(Null) As ICubeInstance;
DefDest := CubeInst.Destinations.DefaultDestination;
SelSet := DefDest.CreateDimSelectionSet;
For i := 0 To SelSet.Count - 1 Do
SelSet.Item(i).SelectAll;
End For;
Debug.WriteLine("---------------Values-------------------");
DestExec := DefDest.CreateExecutorO(CubeInstanceDestinationExecutorOptions.MatrixProxy);
DestExec.PrepareExecute(SelSet);
DestExec.PerformExecute(False);
Proxy := DestExec.Matrix;
Iter := Proxy.CreateIterator;
Iter.Move(IteratorDirection.First);
i := 0;
While Iter.Valid Do
Debug.WriteLine(i.ToString + " Iter.Value = " + Iter.Value);
Iter.Move(IteratorDirection.Next);
i := i + 1;
End While;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Matrix;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
CubeInst: ICubeInstance;
DefDest: ICubeInstanceDestination;
SelSet: IDimSelectionSet;
i: integer;
DestExec: ICubeInstanceDestinationExecutor;
Proxy: IMatrix;
Iter: IMatrixIterator;
Begin
MB := Params.Metabase;
CubeInst := MB.ItemById["CUBE"].Open(Null) As ICubeInstance;
DefDest := CubeInst.Destinations.DefaultDestination;
SelSet := DefDest.CreateDimSelectionSet();
For i := 0 To SelSet.Count - 1 Do
SelSet.Item[i].SelectAll();
End For;
System.Diagnostics.Debug.WriteLine("---------------Values-------------------");
DestExec := DefDest.CreateExecutorO(CubeInstanceDestinationExecutorOptions.cideoMatrixProxy As Integer);
DestExec.PrepareExecute(SelSet);
DestExec.PerformExecute(False);
Proxy := DestExec.Matrix;
Iter := Proxy.CreateIterator();
Iter.Move(IteratorDirection.itdFirst);
i := 0;
While Iter.Valid Do
System.Diagnostics.Debug.WriteLine(i.ToString() + " Iter.Value = " + Iter.Value);
Iter.Move(IteratorDirection.itdNext);
i := i + 1;
End While;
End Sub;
After executing the example the console window displays values of cube matrix elements.
Executing the example requires that the repository contains an ADOMD catalog with the ADOMDTest identifier. The catalog contains the SALES ADOMD cube. The cube structure contains the DATE and TERRITORY dimensions. Add links to the AdoMd, Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
AdomdInst: IAdoMdCubeInstance;
CubeInst: ICubeInstance;
DefDest: ICubeInstanceDestination;
SelSet: IDimSelectionSet;
CubeExecSetup: ICubeExecuteSetup;
DimSetup: ICubeExecuteDimSetup;
DestExec: ICubeInstanceDestinationExecutor;
Matr: IMatrix;
Iter: IMatrixIterator;
i: Integer;
Begin
MB := MetabaseClass.Active;
AdomdInst := MB.ItemByIdNamespace("SALES", MB.GetObjectKeyById("ADOMDTest")).Open(Null) As IAdoMdCubeInstance;
CubeInst := AdomdInst.CubeInstance;
DefDest := CubeInst.Destinations.DefaultDestination;
SelSet := DefDest.CreateDimSelectionSet;
CubeExecSetup := SelSet As ICubeExecuteSetup;
For Each DimSetup In CubeExecSetup Do
If DimSetup.Id = "DATE" Then
DimSetup.Selection.SelectAll;
DimSetup.GroupIndex := 2; //By rows
Elseif DimSetup.Id = "TERRITORY" Then
DimSetup.Selection.SelectAll;
DimSetup.GroupIndex := 1; //By columns
Else
DimSetup.Selection.SelectElement(0, False);
DimSetup.GroupIndex := 0; //Fixed
End If;
End For;
//Prepare for calculation
DestExec := DefDest.CreateExecutorO(CubeInstanceDestinationExecutorOptions.MatrixWOFixed);
DestExec.PrepareExecute(SelSet);
DestExec.PerformExecute;
Matr := DestExec.Matrix;
Debug.WriteLine("---------------Values-------------------");
Debug.WriteLine("Number of values: " + Matr.Count.ToString);
Debug.WriteLine("Number of dimensions: " + Matr.DimensionCount.ToString);
Iter := Matr.CreateIterator;
Iter.Move(IteratorDirection.First);
While Iter.Valid Do
i := i + 1;
Debug.WriteLine("№" + i.ToString + ". Value = " + Iter.Value);
Iter.Move(IteratorDirection.Next);
End While;
End Sub UserProc;
Imports Prognoz.Platform.Interop.AdoMd;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
AdomdInst: IAdoMdCubeInstance;
CubeInst: ICubeInstance;
DefDest: ICubeInstanceDestination;
SelSet: IDimSelectionSet;
CubeExecSetup: ICubeExecuteSetup;
DimSetup: ICubeExecuteDimSetup;
DestExec: ICubeInstanceDestinationExecutor;
Matr: IMatrix;
Iter: IMatrixIterator;
i: Integer;
Begin
MB := Params.Metabase;
AdomdInst := MB.ItemByIdNamespace["SALES", MB.GetObjectKeyById("ADOMDTest")].Open(Null) As IAdoMdCubeInstance;
CubeInst := AdomdInst.CubeInstance;
DefDest := CubeInst.Destinations.DefaultDestination;
SelSet := DefDest.CreateDimSelectionSet();
CubeExecSetup := SelSet As ICubeExecuteSetup;
For Each DimSetup In CubeExecSetup Do
If DimSetup.Id = "DATE" Then
DimSetup.Selection.SelectAll();
DimSetup.GroupIndex := 2; //By rows
Elseif DimSetup.Id = "TERRITORY" Then
DimSetup.Selection.SelectAll();
DimSetup.GroupIndex := 1; //By columns
Else
DimSetup.Selection.SelectElement(0, False);
DimSetup.GroupIndex := 0; //Fixed
End If;
End For;
//Prepare for calculation
DestExec := DefDest.CreateExecutorO(CubeInstanceDestinationExecutorOptions.cideoMatrixWOFixed As Integer);
DestExec.PrepareExecute(SelSet);
DestExec.PerformExecute(False);
Matr := DestExec.Matrix;
System.Diagnostics.Debug.WriteLine("---------------Values-------------------");
System.Diagnostics.Debug.WriteLine("Number of values: " + Matr.Count.ToString());
System.Diagnostics.Debug.WriteLine("Number of dimensions: " + Matr.DimensionCount.ToString());
Iter := Matr.CreateIterator();
Iter.Move(IteratorDirection.itdFirst);
While Iter.Valid Do
i := i + 1;
System.Diagnostics.Debug.WriteLine("№" + i.ToString() + ". Value = " + Iter.Value);
Iter.Move(IteratorDirection.itdNext);
End While;
End Sub;
After executing the example the ADOMD cube is calculated. The dimension selection for calculation is created as follows:
The DATE and TERRITORY dimensions are located by rows and columns, respectively. All elements are selected in the dimensions:
All other dimensions are included into fixed, the first element is selected by them.
During calculation, fixed dimensions are excluded from the output matrix. Calculation results are displayed in the development environment console.
See also: