ICubeExecuteFilterFunctionTop.Function_

Syntax

Function_: String;

Description

The Function_ property determines the function that filters by selecting greatest or least values.

Comments

Available values:

Description of the specified functions is available in documentation for language of multidimensional MDX queries.

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, fact dimension contains the [Measures].[Reseller Order Count] indicator.

Sub UserProc;
Var
    Mb: IMetabase;
    CubeInst: ICubeInstance;
    DestInst: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    CubeExecSet: ICubeExecuteSetup;
    FilterSetup: ICubeExecuteFilterSetup;
    DimSetup: ICubeExecuteDimSetup;
    FilterItem: ICubeExecuteFilterItem;
    TopFunction: ICubeExecuteFilterFunctionTop;
    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
            TopFunction := (FilterSetup As ICubeExecuteFilterFunctionFactory).CreatePredefined(CubeExecuteFilterFunctionPredefined.Top) As ICubeExecuteFilterFunctionTop;
            TopFunction.Function_ := "TOPSUM";
            TopFunction.Argument := "10000";
            TopFunction.Value := "[Measures].[Reseller Order Count]";
            FilterItem := FilterSetup.Add;
            FilterItem.Function_ := TopFunction 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. On calculating the output data set is filtered: only the maximum values, which sum is at least 10000, are included to the set.

See also:

ICubeExecuteFilterFunctionTop