FilterSelection: IDimSelectionSet;
The FilterSelection property determines the selection, according to which displayed data will be filtered.
Filter selection corresponds by default to the IPivot.Selection selection. If one changes selection in the FilterSelection property, the displayed data will be filtered. Elements excluded from selection will be hidden. The IPivot.Selection selection, based on which the table is created, will not change.
To reset filtering, set the FilterSelection property to Null. The filter selection will be restored according to the IPivot.Selection selection.
Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier. The dimension, based on the dictionary with the DICT_COUNTRY identifier, is located in rows in the report.
Add links to the Express, Metabase and Pivot system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Express: IEaxAnalyzer;
Slice: IEaxDataAreaSlice;
Pivot: IPivot;
FilterSet: IPivotFilterSettings;
SelSet: IDimSelectionSet;
Begin
Mb := MetabaseClass.Active;
Express := Mb.ItemById("EXPRESS_REPORT").Edit As IEaxAnalyzer;
// Report's analytical data area slice
Slice := Express.DataArea.Slices.Item(0);
// Table settings
Pivot := Express.Pivot;
Pivot.BeginUpdate;
// Filtering settings
FilterSet := Pivot.Filter As IPivotFilterSettings;
SelSet := FilterSet.FilterSelection.CreateCopy;
// Change dimension selection
SelSet.FindById("DICT_COUNTRY").DeselectAll;
SelSet.FindById("DICT_COUNTRY").SelectElement(1, False);
// Apply selection for filtering
FilterSet.FilterSelection := SelSet;
Pivot.EndUpdate;
// View information about selection in filter and source
Debug.WriteLine(FilterSet.UseFilterSelection);
SelectionInfo(FilterSet.FilterSelection);
SelectionInfo(Pivot.Selection);
// Save changes
(Express As IMetabaseObject).Save;
End Sub UserProc;
Sub SelectionInfo(DimSS: IDimSelectionSet);
Var
DimS: IDimSelection;
Begin
Debug.WriteLine("---");
For Each DimS In DimSS Do
Debug.WriteLine(DimS.Dimension.Ident + ": SelectedCount=" + DimS.SelectedCount.ToString);
End For;
Debug.WriteLine("---");
End Sub SelectionInfo;
After executing the example, filtering by dimension element selection is set up in the report. Only one element will be set as displayed for the specified dimension. Comparative characteristics of the filter selection and the selection, based on which the table is created, will be displayed in the development environment console.
See also: