User Guide
Chapter 9: Handling Complex Data with Structures 111
<CFSET myarray[CurrentRow][1]=test.employee_id[CurrentRow]>
<CFSET myarray[CurrentRow][2]=test.LASTNAME[CurrentRow]>
<CFSET myarray[CurrentRow][3]=test.FIRSTNAME[CurrentRow]>
<CFSET myarray[CurrentRow][4]=test.EMAIL[CurrentRow]>
</CFLOOP>
<!--- Now, create a loop to output the array contents --->
<CFSET Total_Records=Test.RecordCount>
<CFLOOP INDEX="Counter" FROM=1 TO="#Total_Records#">
<CFOUTPUT>
ID: #MyArray[Counter][1]#,
LASTNAME: #MyArray[Counter][2]#,
FIRSTNAME: #MyArray[Counter][3]#,
EMAIL: #MyArray[Counter][4]# <BR>
</CFOUTPUT>
</CFLOOP>
Array Functions
The following functions are available for creating, editing, and handling arrays:
Array Functions
Function Description
ArrayAppend
Appends an array index to the end of a specified array.
ArrayAvg
Returns the average of the values in the specified array.
ArrayClear
Deletes all data in a specified array.
ArrayDeleteAt
Deletes data from a specified array at the specified index.
ArrayInsertAt
Inserts data in a specified array at the specified index.
ArrayIsEmpty
Returns TRUE if the specified array is empty of data.
ArrayLen
Returns the length of the specified array.
ArrayMax
Returns the largest numeric value in the specified array.
ArrayMin
Returns the smallest numeric value in the specified array.
ArrayNew
Creates a new array of specified dimension.
ArrayPrepend
Adds an array element to the beginning of the specified array.