Callback: ICubeCallback;
The Callback property determines an object that handles errors that may occur on cube instance calculation.
Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier.
Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CubeInst: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Sel: IDimSelection;
Exec: ICubeInstanceDestinationExecutor;
Matr: IMatrix;
Iter: IMatrixIterator;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemById("STD_CUBE").Open(Null) As ICubeInstance;
Dest := CubeInst.Destinations.DefaultDestination;
// Create selection
Sels := Dest.CreateDimSelectionSet;
For Each Sel In Sels Do
Sel.SelectAll;
End For;
// Calculation settings
Exec := Dest.CreateExecutor;
Exec.Callback := New TCubeCallback.Create;
Exec.PrepareExecute(Sels);
// Cube calculation
Exec.PerformExecute;
Matr := Exec.Matrix;
Iter := Matr.CreateIterator;
Iter.Move(IteratorDirection.First);
While Iter.Valid Do
Debug.WriteLine(Iter.Value);
Iter.Move(IteratorDirection.Next);
End While;
End Sub UserProc;
Class TCubeCallback: Object, ICubeCallback
Public Sub OnCallback(Argument: ICubeCallbackArgument);
Begin
Debug.WriteLine("Error: " + Argument.Error.Message);
Debug.WriteLine("Error identifier: " + Argument.Error.MessageID.ToString);
Debug.WriteLine("Source: " + Argument.Error.Source);
Argument.IgnoreError := True;
End Sub OnCallback;
Public Function get_Argument: ICubeCallbackArgument;
Begin
Return Null;
End Function get_Argument;
End Class TCubeCallback;
After executing the example the standard cube is calculated by full selection. The console window displays calculated values. The errors that may occur are handled in the TCubeCallback custom class.
See also: