MicroStrategy ONE

Sorting

This section provides examples of browsing the sorting information in a report and changing the sorting.

A MicroStrategy report has three axes— row, column, and page-by. Each of these axes has a collection of sort objects, which define a sequence of sorting keys for the axis. Using the SDK, you can perform tasks such as browsing through the collection, changing a sort object, adding or removing a sort object from the collection, and reordering the sort objects in the collection.

Types of sort objects

All the sorting methods (EnumDSSXMLSortType) can be organized into the following categories.

  • Normal sort— Represented by the WebSort interface in the SDK. It includes SORT_SUBTOTALS_POSITION and SORT_GROUP_BY_METRIC types. SORT_SUBTOTALS_POSIITON defines the position for the subtotals (first, last, inherit or mix, given by EnumDSSXMLSubtotalsPosition). SORT_GROUP_BY_METRIC asks the server to group the result data by metric, instead of the default group by attribute. There is no sorting key for this category.  

  • Default sort— Represented by the WebDefaultSort interface in the SDK. It includes SORT_ATTRIBUTE_DEFAULT, SORT_DIMENSION_DEFAULT, SORT_CONSOLIDATION_DEFAULT, SORT_CUSTOM_GROUP_DEFAULT, and SORT_GROUP_BY_SUBTOTAL types. This category takes the value of the header as the sorting key. The header can be attribute, dimension, consolidation, custom group, and subtotal.  

  • Form Sort— Represented by the WebFormSort interface in the SDK. It includes SORT_ATTRIBUTE_FORM and SORT_DIMENSION_FORM types. This category also takes the value of the header as the sorting key, but the value is the form value of the header, instead of default value as default sort.  

  • Metric Sort— Represented by the WebMetricSort interface in the SDK. It includes SORT_METRIC type. This category takes the value of one of the metrics on the template as the sorting key, which is different from the default sort and form sort.  

Consider the following report for the examples provided. This report does not have any sorting.

 

Year

                         State

CT

NY

Item               Metric

Qty Sold

Qty Sold

1997

5

2746

38902

9

736

387

4

3984

980

Total

7466

40269

1998

8

3876

8700

3

6400

980

Total

10276

9680

Total

17742

49946