Returns the specified array with elements numerically or alphanumerically sorted.
ArraySort(array, sort_type [, sort_order ])
Name of the array you want to sort.
The type of sort to execute. Sort type can be:
numeric
-- Sorts numerically
text
-- Sorts text alphabetically, uppercase before lowercase
textnocase
-- Sorts text alphabetically; case is ignored
The sort order you want to enforce:
<!--- This example shows ArraySort ---> <HTML> <HEAD> <TITLE>ArraySort Example</TITLE> </HEAD> <BODY> <CFQUERY NAME="GetEmployeeNames" DATASOURCE="cfsnippets"> SELECT FirstName, LastName FROM Employees </CFQUERY> <!--- create an array ---> <CFSET myArray = ArrayNew(1)> <!--- loop through the query and append these names successively to the last element ---> <CFLOOP query="GetEmployeeNames"> <CFSET temp= ArrayAppend(myArray, "#FirstName# #LastName#")> </CFLOOP> <!--- show the resulting array as a list ---> <CFSET myList=ArrayToList(myArray, ",")> <!--- sort that array descending alphabetically ---> <CFSET myAlphaArray = ArraySort(myArray, "textnocase", "desc")> ...