Selection: IDimSelectionSet;
The Selection property determines the selection element, by which sorting is executed.
To use this property it is required that the IPivotSortItem.Kind property is set to PivotSortKind.Selection.
Executing the example requires that the repository contains an express report with the EXPRESS identifier containing a table with several non-numeric values. One of table dimensions has the 10152 key.
Add links to the Dimensions, Express, Metabase, Pivot system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Pivot: IPivot;
SortItem: IPivotSortItem;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get express report
Express := MB.ItemById("EXPRESS").Edit As IEaxAnalyzer;
// Get table
Pivot := Express.Pivot;
// Remove all data sortings
Pivot.Sorter.Clear;
// Add a table sorting
SortItem := Pivot.Sorter.Add;
// Check if sorting is enabled
If Not Pivot.Sorter.Enabled Then
Pivot.Sorter.Enabled := True;
End If;
// Descending sorting
SortItem.Direction := PivotSortDirection.Desc;
// Sorting by selection element
SortItem.Kind := PivotSortKind.Selection;
SortItem.Selection.FindByKey(10152).SelectElement(0, False);
// Non-numeric values are located at the table end
SortItem.SkipNonNumeric := True;
// Save dimensions
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example express report table is sorted by selection element. Non-numeric values are located at the end of the table.
See also: