AddCube(Cube: ICubeInstance; Selection: IDimSelectionSet);
Cube. The opened cube instance that must be added for calculation.
Selection. The dimension selection, according to which calculation is executed.
The AddCube method adds a cube to the list for parallel calculation.
The cube must meet the requirements presented in description of the ICubeCombinedExecutor interface.
Executing the example requires that the repository contains two standard cubes with the STD_CUBE1 and STD_CUBE2 identifiers. Cube settings meet the specified requirements. Each cube contains three dimensions.
Add links to the Cubes, Dimensions, ForeSystem, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CubeInst: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
CCE: ICubeCombinedExecutor;
Item: ICubeCombinedExecutorItem;
M: IMatrix;
Iter: IMatrixIterator;
i: Integer;
Begin
MB := MetabaseClass.Active;
CCE := New CubeCombinedExecutor.Create;
//Open the first cube, set selection and add for parallel calculation
CubeInst := MB.ItemById("STD_CUBE1").Open(Null) As ICubeInstance;
Dest := CubeInst.Destinations.DefaultDestination;
Sels := Dest.CreateDimSelectionSet;
Sels.Item(0).SelectAll;
Sels.Item(1).SelectAll;
Sels.Item(2).SelectAll;
CCE.AddCube(CubeInst, Sels);
//Open the second cube, set selection and add for parallel calculation
CubeInst := MB.ItemById("STD_CUBE2").Open(Null) As ICubeInstance;
Dest := CubeInst.Destinations.DefaultDestination;
Sels := Dest.CreateDimSelectionSet;
Sels.Item(0).SelectAll;
Sels.Item(1).SelectAll;
Sels.Item(2).SelectAll;
CCE.AddCube(CubeInst, Sels);
//Calculate added cubes
CCE.Execute;
//Display result for each cube
For i := 0 To CCE.Count - 1 Do
Item := CCE.Item(i);
Debug.WriteLine("Cube: " + (Item.Cube.Cube As IMetabaseObject).Id + ". MultiExecuted: " + Item.MultiExecuted.ToString);
//Matrix with data
M := Item.Matrix;
//Display matrix elements
Iter := M.CreateIterator;
Iter.Move(IteratorDirection.First);
While Iter.Valid Do
Debug.Write(Iter.Value + " ");
Iter.Move(IteratorDirection.Next);
End While;
Debug.WriteLine("");
End For;
End Sub UserProc;
Executing the example calculates two cubes at the same time. Calculation results are displayed in the development environment console.
See also: