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

  1. <!--- This view-only example shows the use of ArrayAvg --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ArrayAvg Example</TITLE>
  5. </HEAD>
  6.  
  7. <BODY>
  8. <H3>ArrayAvg Example</H3>
  9. <P>
  10. This view-only example uses ArrayAvg
  11. to determine the average of the elements
  12. in an array.
  13. <P>
  14. See the View Example pane to view the code.
  15. <!--- create an array --->
  16. <!---
  17. <CFSET myNumberArray = ArrayNew(1)>
  18. --->
  19. <!--- run a standard search --->
  20. <!---
  21.   <CFSEARCH NAME="SearchSnippets"
  22.         COLLECTION="snippets"
  23.         TYPE="simple"
  24.         CRITERIA="Array*">
  25. --->
  26. <!--- 
  27. <CFSET temp = 1>
  28. --->
  29. <!--- output the results of the search --->
  30. <!---
  31. <CFOUTPUT QUERY="SearchSnippets">
  32.     <CFSET myNumberArray[temp] = score>
  33. <CFSET temp = temp + 1>
  34. </CFOUTPUT>
  35. --->
  36. <!--- use ArrayAvg to get the average score --->
  37. <!---
  38. <P>The average score for your search on the term
  39. "Array*" in the collection "Snippets" is 
  40. <CFOUTPUT>#ArrayAvg(myNumberArray)# for
  41. #SearchSnippets.RecordCount# "hits"<BR>
  42. </CFOUTPUT>
  43. --->
  44.  
  45. </BODY>
  46. </HTML>       
  47.