Execute;
The Execute method calculates the output matrix of a calculated cube.
Executing the example requires a calculated cube with the Calc_Cube identifier. The cube contains two dimensions.
Sub Main;
Var
MB: IMetabase;
Cube: ICalculatedCubeInstance;
Exe: ICalculatedCubeExecutor;
Mat: IMatrix;
Coord: IMatrixCoord;
Ite: IMatrixIterator;
Begin
MB := MetabaseClass.Active;
Cube := Mb.ItemById("Calc_Cube").Open(Null) As ICalculatedCubeInstance;
Exe := Cube.CreateExecutor(Null);
(Exe As ICubeInstanceDestinationExecutor).PrepareExecute(Null);
Mat := Exe.Matrix;
Ite := Mat.CreateIterator;
//Detecting coordinate
Coord := Mat.CreateCoord;
Coord.Item(0) := 0;
Coord.Item(1) := 1;
Exe.Selected(Coord) := True; //Assigning element according to coordinate
//Detecting coordinate
Coord := Mat.CreateCoord;
Coord.Item(0) := 1;
Coord.Item(1) := 1;
Exe.Selected(Coord) := True; //Assigning element according to coordinate
Exe.EvaluateOnly := EvaluateOnlyType.Selected; //Calculate only assigned coordinates
Exe.Execute;
Ite.Move(IteratorDirection.First);
While Ite.Valid Do
Debug.WriteLine(Ite.Value);
Ite.Move(IteratorDirection.Next);
End While;
End Sub Main;
After executing the example only assigned coordinates will be calculated. The calculated values will be displayed in the console window. Calculated cube identifier - Calc_Cube.
See also: