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

  1. <!--- This example shows ListSetAt --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ListSetAt Example</TITLE>
  5. </HEAD>
  6.  
  7. <BODY>
  8. <H3>ListSetAt Example</H3>
  9.  
  10. <!--- Find a list of users who wrote messages --->
  11. <CFQUERY NAME="GetMessageUser" DATASOURCE="cfsnippets">
  12. SELECT    Username, Subject, Posted
  13. FROM    Messages
  14. </CFQUERY>
  15.  
  16. <CFSET temp = ValueList(GetMessageUser.Subject)>
  17. <!--- loop through the list and show it with ListGetAt --->
  18. <H3>This is a list of <CFOUTPUT>#ListLen(temp)#</CFOUTPUT>
  19. subjects posted in messages.</H3>
  20.  
  21. <CFSET ChangedItem = ListGetAt("#temp#", 2, ",")>
  22. <CFSET TempToo = ListSetAt("#temp#", 2, "I changed this subject", ",")>
  23. <UL>
  24. <CFLOOP FROM="1" TO="#ListLen(temptoo)#" INDEX="Counter">
  25.     <CFOUTPUT><LI>(#Counter#) SUBJECT: #ListGetAt("#temptoo#", "#Counter#")#</CFOUTPUT>
  26. </CFLOOP>
  27. </UL>
  28. <P>Note that item 2, "<CFOUTPUT>#changedItem#</CFOUTPUT>", has
  29. been altered to "I changed this subject" using ListSetAt.
  30.  
  31. </BODY>
  32. </HTML>       
  33.       
  34.