AllowNull: Boolean;
The AllowNull property determines whether empty values are allowed in the output matrix.
Available values:
True. Default value. Empty values are allowed in the output matrix.
False. Output matrix selection will be changed to exclude the elements, which contain NULL in the matrix.
Executing the example requires a cube with the CUBE identifier.
Add links to the Cubes, Dimensions, Matrix, and Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
CubeDest: ICubeInstanceDestination;
Executor: ICubeInstanceDestinationExecutor;
Sels, FilterSel: IDimSelectionSet;
Sel: IDimSelection;
Factory: IMatrixFactory;
Matrix: IMatrix;
Query: IMatrixQuery;
Filter: IMatrixQueryFilter;
Begin
Mb := MetabaseClass.Active;
// Open cube
CubeDest := (Mb.ItemById("CUBE").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
Factory := New MatrixFactory.Create As IMatrixFactory;
Query := Factory.CreateQuery(Matrix);
Filter := Query.Filter;
// Add a selection for data filtering
FilterSel := CubeDest.CreateDimSelectionSet;
FilterSel.Item(0).SelectElement(0, False);
FilterSel.Item(1).SelectElement(0, False);
// Selection for filtering
Filter.Selection := FilterSel;
Filter.AllowNull := True;
// Execute filtering with AllowNull=True and view output selection
Debug.WriteLine("Filter.AllowNull=True");
Query.Execute;
ShowResult(Query.Result);
// Execute filtering with AllowNull=False and view output selection
Debug.WriteLine("Filter.AllowNull=False");
Filter.AllowNull := False;
Query.Execute;
ShowResult(Query.Result);
End Sub UserProc;
Sub ShowResult(Result: IMatrixQueryResult);
Var
SelFactory: IDimSelectionSetFactory;
ResSels: IDimSelectionSet;
Sel: IDimSelection;
Begin
SelFactory := New DimSelectionSetFactory.Create;
ResSels := SelFactory.CreateDimSelectionSet;
Result.GetSelectionSet(ResSels);
For Each Sel In ResSels Do
Debug.WriteLine("Dimension: " + (Sel.Dimension.Dimension As IMetabaseObject).Id +
".Elements selected: " + Sel.SelectedCount.ToString + " of " + Sel.Dimension.Elements.Count.ToString);
End For;
End Sub ShowResult;
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 selects data by the specified selection is determined in the query. The query will be executed two times - without filtering and with filtering of empty values. After executing the queries the selections corresponding to the matrices with filtered data are obtained. Information about the selections is displayed in the development environment console.
See also: