IPivotTable.Selection

Syntax

Selection: IDimSelectionSet;

Description

The Selection property returns table selection taking into account filtering.

Comments

To get selection of all dimensions of all report's data sources, use the IPivot.Selection property.

Example

Executing the example requires that the repository contains an express report with the EXPRESS_FILTER identifier. The report contains a table.

Add links to the Dimensions, Express, Metabase, Pivot system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Express: IEaxAnalyzer;
    Pivot: IPivot;
    PTable: IPivotTable;
    DimSS: IDimSelectionSet;
    Filter: IPivotFilter;
    FilterSet: IPivotFilterSettings;
    i: Integer;
Begin
    // Get access to repository
    MB := MetabaseClass.Active;
    // Get access to express report
    Express := MB.ItemById("EXP_PTS").Edit As IEaxAnalyzer;
    Pivot := Express.Pivot;
    // Determine filtering parameters in table
    Filter := Pivot.Filter;
    FilterSet := Filter As IPivotFilterSettings;
    // Enable filtering parameters for table
    FilterSet.Enabled := True;
    // Use filtering condition
    FilterSet.UseCondition := True;
    // Set filtering type
    FilterSet.ConditionType := PivotFilterType.Expression;
    // Set expression
    FilterSet.Condition.AsString := "Value<0";
    // Get table
    PTable := Pivot.ObtainTable;
    // Display table selection taking into account filtering
    DimSS := PTable.Selection;
    For i := 0 To DimSS.Count - 1 Do
        Debug.WriteLine(DimSS.Item(i).Dimension.Name);
        Debug.WriteLine(DimSS.Item(i).ToString(Format := "NAME", Separator := ", ", CollectRanges := True));
        Debug.WriteLine("");
    End For;
    // Save changes
    (Express As IMetabaseObject).Save;
End Sub UserProc;

After executing the example data is filtered in express report table. Negative values will be filtered. The console window displays the selection.

See also:

IPivotTable