List.sort([$Attribute])

Tinderbox Icon


Operator Type:   Function
Operator Scope of Action:   Item
Operator Purpose:   Data manipulation

List.sort()

The basic form

$MyList = $MyList.sort() 

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

New to v5.8.0, this function re-sorts the referenced list in lexical, case-sensitive order. This means sorting all upper case letter before any lower case one 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.

In agents

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.


Possible relevant notes (via "Similar Notes" feature):

Up: Item-based operators

A Tinderbox Reference File : Actions & Rules : Operators : Action Operator Scope : Item-based operators : List.sort([$Attribute])

Quicklinks: Attributes | Action Codes | Export Codes | Designators | Date Formats | aTbRef Site Map

[Last updated: 16 May 2012, using v5.11.1]


Search:

Google search aTbRef for:  


Creative Commons Licence

aTbRef by Mark Anderson is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

[See aTbRef CC licence Attribution & Waiver info]

Made with Tinderbox