home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / arraylen.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  896 b   |  34 lines

  1. <!--- This example shows ArrayLen --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ArrayLen Example</TITLE>
  5. </HEAD>
  6.  
  7. <BODY>
  8. <H3>ArrayLen Example</H3>
  9.  
  10. <CFQUERY NAME="GetEmployeeNames" DATASOURCE="cfsnippets">
  11. SELECT FirstName, LastName FROM Employees
  12. </CFQUERY>
  13. <!--- create an array --->
  14. <CFSET myArray = ArrayNew(1)>
  15. <!--- set element one to show where we are --->
  16. <CFSET myArray[1] = "Test Value">
  17. <!--- loop through the query and append these names
  18. successively to the last element --->
  19. <CFLOOP query="GetEmployeeNames">
  20.     <CFSET temp= #ArrayAppend(myArray, "#FirstName# #LastName#")#>
  21. </CFLOOP>
  22. <!--- show the resulting array as a list --->
  23. <CFSET myList=ArrayToList(myArray, ",")>
  24. <!--- output the array as a list --->
  25. <CFOUTPUT>
  26.     <P>The contents of the array are as follows:
  27.     <P>#myList#
  28.     <P>This array has #ArrayLen(MyArray)# elements.
  29. </CFOUTPUT>
  30.  
  31. </BODY>
  32. </HTML>       
  33.       
  34.