ICubeExecuteFilterFunctionNonEmpty.Function_

Fore Syntax

Function_: String;

Fore.NET Syntax

@Function: String;

Description

The Function_ property determines the function used for filtering of empty values.

Comments

The property is not set by default, the NON EMPTY keyword is used in the query.

To use the NonEmpty function:

  1. Specify the NonEmpty value in the Function property.

  2. Set the NonEmpty property to True.

  3. Specify in round brackets selection of dimension elements, for which filtering of empty values is applied, in the Set_ property.

Description of the NON EMPTY keyword, the NonEmpty function and differences in their work are available in the documentation for language of MDX multidimensional queries.

Fore Example

Executing the example requires that the repository contains an ADOMD catalog with the ADOMDTest identifier, this catalog contains the SALES ADOMD cube. The cube structure must have dimensions based on ADOMD dictionaries with the DATE and COUNTRY identifiers.

Sub UserProc;
Var
    Mb: IMetabase;
    CubeInst: ICubeInstance;
    DestInst: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    CubeExecSet: ICubeExecuteSetup;
    FilterSetup: ICubeExecuteFilterSetup;
    DimSetup: ICubeExecuteDimSetup;
    FilterItem: ICubeExecuteFilterItem;
    NonEmptyFunction: ICubeExecuteFilterFunctionNonEmpty;
    Exec: ICubeInstanceDestinationExecutor;
    Matr: IMatrix;
Begin
    Mb := MetabaseClass.Active;
    CubeInst := MB.ItemByIdNamespace("SALES", MB.GetObjectKeyById("ADOMDTest")).Open(NullAs ICubeInstance;
    DestInst := CubeInst.Destinations.DefaultDestination;
    Sels := DestInst.CreateDimSelectionSet;
    CubeExecSet := Sels As ICubeExecuteSetup;
    //Get object to set up filtering by dimensions
    FilterSetup := CubeExecSet.Filter;
    //Distribute dimensions by groups, set selection and dimension filter
    For Each DimSetup In CubeExecSet Do
        If DimSetup.Id = "DATE" Then
            DimSetup.Selection.SelectAll;
            DimSetup.GroupIndex := 2//By rows
            NonEmptyFunction := (FilterSetup As ICubeExecuteFilterFunctionFactory).CreatePredefined(CubeExecuteFilterFunctionPredefined.NonEmpty) As ICubeExecuteFilterFunctionNonEmpty;
            NonEmptyFunction.NonEmpty := True;
            NonEmptyFunction.Function_ := "NonEmpty";
            NonEmptyFunction.Set_ := "([Date].[Fiscal].AllMembers,[Country].Children)";
            FilterItem := FilterSetup.Add;
            FilterItem.Function_ := NonEmptyFunction As ICubeExecuteFilterFunction;
            FilterItem.Dimension := DimSetup;
        Elseif DimSetup.Id = "COUNTRY" Then
            DimSetup.Selection.SelectElement(1False);
            DimSetup.GroupIndex := 1//By columns
        Else
            DimSetup.Selection.SelectElement(0False);
            DimSetup.GroupIndex := 0//Other dimensions into fixed ones
        End If;
    End For;
    //Prepare for calculation
    Exec := DestInst.CreateExecutor;
    Exec.PrepareExecute(Sels);
    //Calculation
    Exec.PerformExecute;
    //Get matrix with calculation results
    Matr := Exec.Matrix;
End Sub UserProc;

On executing the example the specified ADOMD cube is prepared and calculated. The empty values that are found at the intersection of axes in the DATE and COUNTRY database, are filtered from the output set. Filtering is executed by means of the NonEmpty function.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    CubeInst: ICubeInstance;
    DestInst: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    CubeExecSet: ICubeExecuteSetup;
    FilterSetup: ICubeExecuteFilterSetup;
    DimSetup: ICubeExecuteDimSetup;
    FilterItem: ICubeExecuteFilterItem;
    NonEmptyFunction: ICubeExecuteFilterFunctionNonEmpty;
    Exec: ICubeInstanceDestinationExecutor;
    Matr: IMatrix;
Begin
    Mb := Params.Metabase;
    CubeInst := MB.ItemByIdNamespace["SALES", MB.GetObjectKeyById("ADOMDTest")].Open(NullAs ICubeInstance;
    DestInst := CubeInst.Destinations.DefaultDestination;
    Sels := DestInst.CreateDimSelectionSet();
    CubeExecSet := Sels As ICubeExecuteSetup;
    //Get object to set up filtering by dimensions
    FilterSetup := CubeExecSet.Filter;
    //Distribute dimensions by groups, set selection and dimension filter
    For Each DimSetup In CubeExecSet Do
        If DimSetup.Id = "DATE" Then
            DimSetup.Selection.SelectAll();
            DimSetup.GroupIndex := 2//By rows
            NonEmptyFunction := (FilterSetup As ICubeExecuteFilterFunctionFactory).CreatePredefined(CubeExecuteFilterFunctionPredefined.cuexfifuprNonEmpty) As ICubeExecuteFilterFunctionNonEmpty;
            NonEmptyFunction.NonEmpty := True;
            NonEmptyFunction.@Function := "NonEmpty";
            NonEmptyFunction.@Set := "([Date].[Fiscal].AllMembers,[Country].Children)";
            FilterItem := FilterSetup.Add();
            FilterItem.@Function := NonEmptyFunction As ICubeExecuteFilterFunction;
            FilterItem.Dimension := DimSetup;
        Elseif DimSetup.Id = "COUNTRY" Then
            DimSetup.Selection.SelectElement(1False);
            DimSetup.GroupIndex := 1//By columns
        Else
            DimSetup.Selection.SelectElement(0False);
            DimSetup.GroupIndex := 0//Other dimensions into fixed ones
        End If;
    End For;
    //Prepare for calculation
    Exec := DestInst.CreateExecutor();
    Exec.PrepareExecute(Sels);
    //Calculation
    Exec.PerformExecute(False);
    //Get matrix with calculation results
    Matr := Exec.Matrix;
End Sub;

See also:

ICubeExecuteFilterFunctionNonEmpty