Item(Index: Integer): IBitArray;
Index. Bit array index.
The Item property returns the bit array with information about dimension element selection.
The bit array index that is specified in the Index parameter corresponds to the dimension index in the selection specified in the IMatrixQuery.Select property. Length of the Length bit array will be equal to index of the last element selected to get the filtered matrix, and the number of elements Count will be equal to the number of selected dimension elements.
Executing the example requires a cube with the CUBE identifier.
Add links to the Collections, Cubes, Dimensions, Matrix, and Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
CubeDest: ICubeInstanceDestination;
Executor: ICubeInstanceDestinationExecutor;
Sels: IDimSelectionSet;
Sel: IDimSelection;
Matrix: IMatrix;
MatFac: MatrixFactory;
Query: IMatrixQuery;
Filter: IMatrixQueryFilter;
Range: IMatrixQueryFilterRange;
Result: IMatrixQueryResult;
Arr: IBitArray;
i, j: Integer;
Begin
Mb := MetabaseClass.Active;
// Open cube
CubeDest := (Mb.ItemById("OBJ8240").Open(Null) As ICubeInstance).Destinations.DefaultDestination;
Executor := CubeDest.CreateExecutor;
// Create selection
Sels := CubeDest.CreateDimSelectionSet;
For Each Sel In Sels Do
Sel.SelectAll;
End For;
// Get matrix with cube data
Executor.PrepareExecute(Sels);
Executor.PerformExecuteO(CubeInstanceDestinationExecutorOptions.Cached);
Matrix := Executor.Matrix;
// Create a query
MatFac := New MatrixFactory.Create;
Query := (MatFac As IMatrixFactory).CreateQuery(Matrix);
// Set up matrix data filtering parameters
Filter := Query.Filter;
// Add a data filtering range
Range := Filter.Ranges.Add;
Range.Min := 1;
Range.Max := 10;
// Selection for filtering
Filter.Selection := Sels;
// Execute query
Query.Execute;
// Get query result
Result := Query.Result;
Debug.WriteLine("Number of elements in Result: " + Result.Count.ToString);
For i := 0 To Result.Count - 1 Do
Arr := Result.Item(i);
Debug.WriteLine("Elements: " + Arr.Length.ToString + ", selected: " + Arr.Count.ToString);
Debug.Indent;
For j := 0 To Arr.Length - 1 Do
Debug.WriteLine("The element " + j.ToString + (Arr.Item(j)? " is selected" : " is not selected"));
End For;
Debug.Unindent;
End For;
End Sub UserProc;
After executing the example the cube opens and its matrix with data by full selection is obtained. A query will be created that gets information about matrix data, a filter that selected data in from the specified range is determined in the query. After executing the query, the bit array with information about selected elements is obtained for each dimension. Information from the bit arrays is displayed in the development environment console.
See also: