Selection: IDimSelectionSet;
Selection: Prognoz.Platform.Interop.Dimensions.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.
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;
SortItem: IPivotSortItem;
Begin
// Get repository
MB := Params.Metabase;
// 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.psdDesc;
// Sorting by selection element
SortItem.Kind := PivotSortKind.pskSelection;
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;
See also: