AddCubeDest(CubeDest: ICubeInstanceDestination; Selection: IDimSelectionSet);
AddCubeDest(CubeDest: Prognoz.Platform.Interop.Cubes.ICubeInstanceDestination; Selection: Prognoz.Platform.Interop.Dimensions.IDimSelectionSet);
CubeDest. Cube display version that must be added for calculation.
Selection. The dimension selection, according to which calculation is executed.
The AddCubeDest method adds a cube display version into the list for parallel calculation.
The cube, for which the display version is obtained, must meet the requirements presented in description of the ICubeCombinedExecutor interface.
Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. The cube includes three dimensions; two display versions are created and set up in the cube. Cube settings meet the specified requirements.
Add links to the Cubes, Dimensions, ForeSystem, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CubeInst: ICubeInstance;
Dests: ICubeInstanceDestinations;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
CCE: ICubeCombinedExecutor;
Item: ICubeCombinedExecutorItem;
M: IMatrix;
Iter: IMatrixIterator;
i: Integer;
Begin
MB := MetabaseClass.Active;
CCE := New CubeCombinedExecutor.Create;
//Open cube, get the first display version, set selection and add for parallel calculation
CubeInst := MB.ItemById("STD_CUBE").Open(Null) As ICubeInstance;
Dests := CubeInst.Destinations;
Dest := Dests.Item(0);
Sels := Dest.CreateDimSelectionSet;
Sels.Item(0).SelectAll;
Sels.Item(1).SelectAll;
Sels.Item(2).SelectAll;
CCE.AddCubeDest(Dest, Sels);
//Get the second display version, set selection and add for parallel calculation
Dest := Dests.Item(1);
Sels := Dest.CreateDimSelectionSet;
Sels.Item(0).SelectAll;
Sels.Item(1).SelectAll;
Sels.Item(2).SelectAll;
CCE.AddCubeDest(Dest, Sels);
//Calculate added cube display versions
CCE.Execute;
//Display result for each cube display version
For i := 0 To CCE.Count - 1 Do
Item := CCE.Item(i);
Debug.WriteLine("Display version: " + Item.Destination.Name + ". 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;
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;
CubeInst: ICubeInstance;
Dests: ICubeInstanceDestinations;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
CCE: ICubeCombinedExecutor = New CubeCombinedExecutorClass();
Item: ICubeCombinedExecutorItem;
M: IMatrix;
Iter: IMatrixIterator;
i: Integer;
Begin
MB := Params.Metabase;
//Open cube, get the first display version, set selection and add for parallel calculation
CubeInst := MB.ItemById["STD_CUBE"].Open(Null) As ICubeInstance;
Dests := CubeInst.Destinations;
Dest := Dests.Item[0];
Sels := Dest.CreateDimSelectionSet();
Sels.Item[0].SelectAll();
Sels.Item[1].SelectAll();
Sels.Item[2].SelectAll();
CCE.AddCubeDest(Dest, Sels);
//Get the second display version, set selection and add for parallel calculation
Dest := Dests.Item[1];
Sels := Dest.CreateDimSelectionSet();
Sels.Item[0].SelectAll();
Sels.Item[1].SelectAll();
Sels.Item[2].SelectAll();
CCE.AddCubeDest(Dest, Sels);
//Calculate added cube display versions
CCE.Execute();
//Display result for each cube display version
For i := 0 To CCE.Count - 1 Do
Item := CCE.Item[i];
System.Diagnostics.Debug.WriteLine("Display version: " + Item.Destination.Name + ". MultiExecuted: " + Item.MultiExecuted.ToString());
//Matrix with data
M := Item.Matrix;
//Display matrix elements
Iter := M.CreateIterator();
Iter.Move(IteratorDirection.itdFirst);
While Iter.Valid Do
System.Diagnostics.Debug.Write(Iter.Value + " ");
Iter.Move(IteratorDirection.itdNext);
End While;
System.Diagnostics.Debug.WriteLine("");
End For;
End Sub;
Executing the example implements parallel calculation of two cube display versions. Calculation results are displayed in the development environment console.
See also: