SupportedDataRights: CubeDataRights;
The SupportedDataRights property returns requested data access permissions.
Executing the example requires that the repository contains a time series database with the FC_A identifier.
Add links to the Cubes, Dimensions, MatFin, Matrix, and Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Cat: IMetabaseObject;
Inst: IRubricatorInstance;
Cub: ICubeInstance;
Dest: ICubeInstanceDestination;
Exe: ICubeInstanceDestinationExecutor;
Sels: IDimSelectionSet;
Sel: IDimSelection;
Arr: Array[1] Of Integer;
Si, Sc: Integer;
Mat: IMatrix;
ExecuteResult: ICubeExecuteResult;
It: IMatrixIterator;
Coo: IMatrixCoord;
Sto: ICubeInstanceStorage;
Rights: ICubeExecuteDataRights;
Begin
Mb := MetabaseClass.Active;
// Get time series database
Cat := Mb.ItemById("FC_A").Bind;
Inst := Cat.Open(Null) As IRubricatorInstance;
// Convert opened instance of TSDB to cube instance
Cub := Inst As ICubeInstance;
// Create a cube selection
Dest := Cub.Destinations.DefaultDestination;
Sels := Dest.CreateDimSelectionSet;
Sc := Sels.Count - 1;
For Si := 0 To Sc Do
Sel := Sels.Item(Si);
Sel.SelectAll;
End For;
// Create an object for cube matrix calculation
Exe := Dest.CreateExecutor;
(Exe As IRubricatorFactorIO).MultipleFactors := True;
// Set indicator that should be calculated
Arr[0] := 125616;
(Exe As IRubricatorFactorExecutor).SetFactorKeys(Arr);
// Determine access permissions for data that will be returned after calculation - read and change data
(Sels As ICubeExecuteSetup).RequiredDataRights := CubeDataRights.ReadWrite;
Exe.PrepareExecute(Sels);
// Get matrix with data
Mat := Exe.Matrix;
// Calculate cube by the specified matrix
ExecuteResult := CubeClass.ExecuteResult(Mat);
Rights := ExecuteResult.DataRights;
If Rights <> Null Then
Exe.PerformExecute;
Mat.ValueFlag := 1;
// Create an object that is a matrix coordinate
Coo := Rights.CoordMatrix.CreateCoord;
// Create an iterator for navigation by matrix elements
It := Mat.CreateIterator;
// Populate matrix with random data
It.Move(IteratorDirection.First);
While It.Valid Do
It.ValueFlag := 0;
If Rights.Rights(Coo) = Rights.SupportedDataRights Then
It.ValueFlag := 1;
It.Value := Math.RandBetweenI(0, 5);
End If;
It.Move(IteratorDirection.Next);
End While;
// Create an object to save data to cube
Sto := Dest.CreateStorage;
(Sto As IRubricatorFactorIO).MultipleFactors := True;
// Save matrix with data to cube
Sto.SaveMatrix(Mat, 1);
End If;
End Sub UserProc;
After executing the example data of time series with the 125616 key, to which the user has read and write permissions, is obtained. If requested and actual permissions to access to the point match, its data is changed and saved.
See also: