DimKey: Integer;
The DimKey property determines the dimension key, by which sorting is executed.
To use this property it is required that the IPivotSortItem.Kind property is set to PivotSortKind.Dimension.
To determine dimension attribute key, use IPivotSortItem.AttributeKey.
Executing the example requires that the repository contains an express report with the EXPRESS identifier containing a table.
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;
// Ascending sorting
SortItem.Direction := PivotSortDirection.Asc;
// Sort by calendar dimension
SortItem.Kind := PivotSortKind.Dimension;
SortItem.DimKey := Pivot.DimItem(0).Key;
// Sort by first dimension attribute
SortItem.AttributeKey := Pivot.DimItem(0).Attributes.Item(0).Attribute.Key;
// Save dimensions
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example express report table is sorted by the first attribute of calendar dimension.
See also: