IPivotTable.Selection

Fore Syntax

Selection: IDimSelectionSet;

Fore.NET Syntax

Selection: Prognoz.Platform.Interop.Dimensions.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.

Fore 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.

Fore.NET Example

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

Imports   Prognoz.Platform.Interop.Dimensions;
Imports   Prognoz.Platform.Interop.Express;
Imports   Prognoz.Platform.Interop.Pivot;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Express: IEaxAnalyzer;
    Pivot: IPivot;
    PTable: IPivotTable;
    DimSS: IDimSelectionSet;
    Filter: IPivotFilter;
    FilterSet: IPivotFilterSettings;
    i: Integer;
Begin
    // Get access to repository
    MB := Params.Metabase;
    // 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.pftExpression;
    // Set expression
    FilterSet.Condition.AsString := "Value<0";
    // Get table
    PTable := Pivot.ObtainTable();
    // Display table selection parameters taking into account filtering
    DimSS := PTable.Selection;
    For i := 0 To DimSS.Count - 1 Do
        System.Diagnostics.Debug.WriteLine(DimSS.Item[i].Dimension.Name);
        System.Diagnostics.Debug.WriteLine(DimSS.Item[i].ToString("NAME"", "True));
        System.Diagnostics.Debug.WriteLine("");
    End For;
    // Save changes
    (Express As IMetabaseObject).Save();
End Sub;

See also:

IPivotTable