IMatrixQueryFilter.AllowNull

Syntax

AllowNull: Boolean;

Description

The AllowNull property determines whether empty values are allowed in the output matrix.

Comments

Available values:

Example

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(NullAs 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(0False);
    FilterSel.Item(1).SelectElement(0False);
    // 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:

IMatrixQueryFilter