<!--- This example shows ArraySort --->

<HTML>
<HEAD>
<TITLE>ArraySort Example</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">

<H3>ArraySort Example</H3>

<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")>
<!--- show the resulting alphabetized array as a list --->
<CFSET myAlphaList=ArrayToList(myArray, ",")>
<!--- output the array as a list --->
<CFOUTPUT>
	<P>The contents of the array are as follows:
	<P>#myList#
	<P>This array, alphabetized by first name (descending):
	<P>#myAlphaList#
	<P>This array has #ArrayLen(MyArray)# elements.
</CFOUTPUT>

</BODY>
</HTML>       
