Options. Cube calculation parameters.
The PerformExecuteO method calculates a cube in the specified mode.
If the cube output matrix is calculated on the basis of cached data (Options = CubeInstanceDestinationExecutorOptions.Cached), the further working with obtained data must be executed using read/write locks on the application level. To use locks, cast the obtained Matrix matrix to the IRWMutex interface and use their methods to enable or disable the required lock.
Executing the example requires that the repository contains a time series database with the FC_ 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.
Sub UserProc;
Var
MB: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
RubrIn: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Sel: IDimSelection;
DictDescr: IMetabaseObjectDescriptor;
DictInst: IDimInstance;
Exec: ICubeInstanceDestinationExecutor;
Mat: IMatrix;
Iter: IMatrixIterator;
Begin
MB := MetabaseClass.Active;
RubDesc := MB.ItemById("FC_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.ScenarioKey := -1;
Exec.PrepareExecute(Sels);
Exec.PerformExecuteO(CubeInstanceDestinationExecutorOptions.Reload);
Mat := Exec.Matrix;
Iter := Mat.CreateIterator;
Iter.Move(IteratorDirection.First);
While Iter.Valid Do
Debug.WriteLine(Iter.Value);
Iter.Move(IteratorDirection.Next);
End While;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.ForeSystem;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RubDesc: IMetabaseObjectDescriptor;
RubrIn: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
Sels: IDimSelectionSet;
Sel: IDimSelection;
DictDescr: IMetabaseObjectDescriptor;
DictInst: IDimInstance;
Exec: ICubeInstanceDestinationExecutor;
Mat: IMatrix;
Iter: IMatrixIterator;
Begin
MB := Self.Metabase;
RubDesc := MB.ItemById["FC_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.ScenarioKey := UInteger.MaxValue;
Exec.PrepareExecute(Sels);
Exec.PerformExecuteO(CubeInstanceDestinationExecutorOptions.cideoReload As Integer);
Mat := Exec.Matrix;
Iter := Mat.CreateIterator();
Iter.Move(IteratorDirection.itdFirst);
While Iter.Valid Do
System.Diagnostics.Debug.WriteLine(Iter.Value);
Iter.Move(IteratorDirection.itdNext);
End While;
End Sub;
After executing the example data of the time series database is presented as a cube data instance. The cache of the object data will be recalculated and reloaded from the database, after that the calculation is executed and the obtained data will be displayed in the console window.
See also: