ApplySelectionToFilterRange(Range: IPivotFilterRange);
Range. Table area.
The ApplySelectionToFilterRange method passes parameters of table area as the range, in which data is filtered.
To set selected table area, use ITabSheet.Cells and ITabSelection.AddRange.
Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier that contains a table.
Add links to the Express, Metabase, Pivot and Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Pivot: IPivot;
Grid: IEaxGrid;
Filter: IPivotFilter;
Range: IPivotFilterRange;
TabRange: ITabRange;
Selection: ITabSelection;
TabView: ITabView;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get express report
Express := MB.ItemById("EXPRESS_REPORT").Edit As IEaxAnalyzer;
// Get settings of table data displaying
Pivot := Express.Pivot;
// Get filtering parameters
Filter := Pivot.Filter;
// Set filtering condition - greater than the number
Filter.ConditionType := PivotFilterType.GA;
// Set the number
Filter.ConditionValueA := 15;
// Set filtering by rows
Filter.Elements := PivotFilterElements.Rows;
// Get filtering range
Range := Filter.Range;
// Get report data table
Grid := Express.Grid;
// Set selected area range
TabRange := Grid.TabSheet.Cells(1, 1, 5, 5);
// Get spreadsheet view
TabView := Grid.TabSheet.View;
// Get the current selection in table
Selection := TabView.Selection;
// Add the range to the table selection
Selection.AddRange(TabRange);
// Pass the table selection to the filtering range
Grid.ApplySelectionToFilterRange(Range);
// Set the area, for which filtering is applied
Filter.Area := PivotFilterArea.Range;
// Apply filtering to the data table
Filter.UseCondition := True;
// Save changes
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, data filtering in specified range of selected table area will be executed. Data will be filtered by rows were value is bigger than 15.
See also: