Callback: ICubeCallback;
The Callback property determines an object that handles errors that can occur on cube instance calculation.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier. This database must include a unique attribute that refers to the dictionary with the DICT_IND identifier stored in the MDM repository with the MDM_REPO identifier.
Class CubeCallback: 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 CubeCallback;
Sub Main;
Var
MB: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
RubrIn: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Sel: IDimSelection;
DictDescr: IMetabaseObjectDescriptor;
DictInst: IDimInstance;
Exec: ICubeInstanceDestinationExecutor;
Mat: IMatrix;
Ite: IMatrixIterator;
Begin
MB := MetabaseClass.Active;
RubDesc := MB.ItemById("OBJ_RUBRICATOR");
RubrIn := RubDesc.Open(Null) As IRubricatorInstance;
Cub := RubrIn As ICubeInstance;
Dest := Cub.Destinations.DefaultDestination;
Sels := Dest.CreateDimSelectionSet;
Sels.Clear;
Sel := Sels.Add(RubrIn.CalendarLevelsDimension);
Sel.SelectAll;
DictDescr := MB.ItemByIdNamespace("DICT_IND", MB.ItemById("RDS_REPO").Key);
DictInst := DictDescr.Open(Null) As IDimInstance;
Sel := Sels.Add(DictInst);
Sel.SelectElement(0, False);
Exec := Dest.CreateExecutor;
Exec.WithoutScaling := True;
Exec.ScenarioKey := -1;
Exec.Callback := New CubeCallback.Create;
Exec.PrepareExecute(Sels);
Exec.PerformExecute;
Mat := Exec.Matrix;
Ite := Mat.CreateIterator;
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 data of the time series database is represented as data of a cube instance. The calculated time series data by specified selection is displayed in the console window. Errors that may occur are handled in the CubeCallback custom class.
See also: