Description
A CMcDBQuery object can have the McDBNodes matching its specification returned in sorted order using this method. Sort orders are applied in the order added. That is, the first call to AddSortOrder sets a primary sorting key, and subsequent call(s) specify secondary sorting key(s) (i.e. only used as a tiebreaker for equal values of the more primary sorting key(s)).
-
Return Type
-
None
-
Syntax
-
object.AddSortOrder [SortKey], [Order]
The AddSortOrder Method syntax has these parts: |
| object | An expression evaluating to an object of type McDBQuery. | | SortKey | Optional. A mcDBSortItem enumeration, as described in settings. The key to use as the basis for sorting.
| | Order | Optional. A mcDBOrdering enumeration, as described in settings. Whether items are sorted on the specified key in ascending or descending order.
| Settings The settings for SortKey are:
 | mcdbName | 0 |
Sort by Name
|
 | mcdbCreator | 1 |
Sort by Creator
|
 | mcdbCreateDate | 2 |
Sort by Date Created
|
 | mcdbModifier | 3 |
Sort by Modifier
|
 | mcdbModifyDate | 4 |
Sort by Date Modified
|
 | mcdbTypeName | 5 |
Sort by Name of McDBType
|
 | mcdbAttributeValue | 6 |
Sort by Named Attribute [Value] (not valid for McDBNodes.AddSortOrder)
|
 | mcdbCategory | 7 |
Sort by Category
|
 | mcdbDataString | 8 |
Sort by Strings in Data Property
|
The settings for Order are:
 | mcdbAscending | 0 |
Sort in Ascending Order
|
 | mcdbDescending | 1 |
Sort in Descending Order
|
 | mcdbNone | 2 |
Do not Sort
|
Remarks
As McDBQuery objects are inherently stateful, there are certain rules that prescribe the behavior of this method and when it is usable:
If SortKey is mcdbTypeName, mcdbAttributeValue, mcdbCategory, or mcdbDataString, this method determines the sort order on successive calls to SetType(), SetAttribute(), SetCategory(), and SetDataString(), respectively. Therefore this method may be called after the query specification begins only if one of these three values is used for SortKey. [e.g. To have the results sorted with ascending values for the first attribute primarily, then in descending values for a second attribute, call this method twice during the entire specification: once before each call to SetAttribute()]. To turn off sorting on any of these keys for successive calls to SetType() and/or SetAttribute(), call this method with Order set to mcdbNone.
Calling this method multiple times with different Order values for the same SortKey will have no effect, except for the SortKey values mcdbTypeName, mcdbAttributeValue, mcdbCategory, and mcdbDataString, as described above.
|