Sets the sort order.
Syntax
Parameters
- levelOrAttributeUniqueName
- The affected attribute or hierarchy level.
- shelf
- The affected shelf.
- sortConstraint
- The sort constraints.
Return Value
A reference to this instance after the operation has completed.
Example
The following code demonstrates the sorting of the 1st level of hierarchy by measure.
| C# | Copy Code |
|---|
SchemaDefinition schema = pivotView.DataSource.Schema;
using (ILayoutActions la = pivotView.BeginLayoutUpdate("Set Sort Order"))
{
Hierarchy affectedHierarchy = schema.Get<Hierarchy>("[Pub Date].[Pub Date]");
int affectedLevel = 1;
ShelfKind affectedShelf = ShelfKind.ColumnShelf;
string sortByMeasure = "[Measures].[Total Cost]";
la.InsertField(affectedHierarchy.UniqueName, affectedShelf, 0).
SetSortOrder(affectedHierarchy.Levels[affectedLevel].UniqueName, affectedShelf,
Sort.Descending.ByExpression(sortByMeasure));
la.Commit();
} |
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also