Description

Have Item and For Each enumerator return the McDBNode instances of this collection in a sorted order.

Return Type

None  

Syntax

object.AddSortOrder [SortKey], [Order]

The AddSortOrder Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McDBNodes.
SortKeyOptional. A mcDBSortItem enumeration, as described in settings.

The key (aspect/property) of the McDBNode instances in this collection that orders their sorting.

OrderOptional. A mcDBOrdering enumeration, as described in settings.

Whether items are sorted on the SortKey are in mcdbAscending or mcdbDescending order. The value mcdbNone is valid, but has no effect when passed for this parameter.

Settings

The settings for SortKey are:

ConstantValueDescription
 mcdbName0

Sort by Name

 mcdbCreator1

Sort by Creator

 mcdbCreateDate2

Sort by Date Created

 mcdbModifier3

Sort by Modifier

 mcdbModifyDate4

Sort by Date Modified

 mcdbTypeName5

Sort by Name of McDBType

 mcdbAttributeValue6

Sort by Named Attribute [Value] (not valid for McDBNodes.AddSortOrder)

 mcdbCategory7

Sort by Category

 mcdbDataString8

Sort by Strings in Data Property

The settings for Order are:

ConstantValueDescription
 mcdbAscending0

Sort in Ascending Order

 mcdbDescending1

Sort in Descending Order

 mcdbNone2

Do not Sort

Remarks

A McDBNodes collection will return its McDBNode Item instance(s) in sorted order after calling this method. Sort order specifications (calls to AddSortOrder) are addative. Therefore, to change the sort ordering on a collection, first call the ClearSortOrder method, then all of the desired sort order specifications may be added with AddSortOrder.

Exceptions

Error Value Description
E_INVALIDARG &H80070057 SortKey is mcdbAttributeValue.

Notes

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)). The SortKey mcdbAttributeValue may not be specified for McDBNodes.AddSortOrder, only McDBQuery.AddSortOrder. Further, the SortKey mcdbTypeName, is always the lowest priority order for sorting. That is, when multiple calls to AddSortOrder are made, the McDBType.Name will always be the “last tiebreaker”, regardless of when in the sequence of calls to AddSortOrder it is made.