home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 139 / dpcs0999.iso / Web / CFserver / data1.cab / Documentation / snippets / listsetat.cfm < prev    next >
Encoding:
Text File  |  1999-04-12  |  1020 b   |  35 lines

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