This version is out of date, covering development from v6.0.0 to v6.6.5. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

TinderboxSix Icon

List.sort([$Attribute])


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Data manipulation   [other Data manipulation operators]

 Baseline

 


List.sort()

The basic form

$MyList = $MyList.sort() 

$MyList = $MyList.sort().reverse() 

This function re-sorts the referenced list in lexical, case-sensitive order. This means sorting all upper case letters before any lower case ones as in "Ant;Bee;Cow;ant;bee;cow". Users of non-accented languages (for the content of their notes) will likely find the case-insensitive List.isort() of more practical use. A forced numerical sort (1,2,11 not 1,11,2) can be achieved by using List.nsort(). Or, use the optional long from (below) and let the nominated attribute's data type set the form of sort, e.g for date sorting.

The resulting sort order can be reversed overall by chaining the List.sort() and List.reverse() functions.

Sets can be sorted, on the fly, so a sorted output can be passed to a List. Passing the sorted output of a Set to another Set has an unknown outcome, in terms of stored sort order.

List.sort($Attribute)

In this optional extended form there is a requirement that the referenced list is a list of notes names or paths, i.e. $Path data or $Name data where note names are all unique. In such a case, the sort order can be based on a stipulated $Attribute name.

$MyList = $MyList.sort($Name) 

$MyList = $MyList.sort($MyString) 

$MyList = $MyList.sort($Name).reverse() 

In this long form usage, the sort ordering is based on the data type of $Attribute:

With sort() lexical sorts are always case-sensitive.



A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : List.sort([$Attribute])