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

  1. <!--- This example shows ListPrepend --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>ListPrepend Example</TITLE>
  5. </HEAD>
  6.  
  7. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  8. <BODY  bgcolor="#FFFFD5">
  9. <H3>ListPrepend Example</H3>
  10.  
  11. <!--- First, query to get some values for our list --->
  12. <CFQUERY NAME="GetParkInfo" DATASOURCE="cfsnippets">
  13. SELECT     PARKNAME,CITY,STATE
  14. FROM    Parks
  15. WHERE    PARKNAME LIKE 'DE%'
  16. </CFQUERY>
  17. <CFSET temp = #ValueList(GetParkInfo.ParkName)#>
  18. <CFSET first_item = ListFirst(temp)>
  19.  
  20. <CFOUTPUT>
  21. <P>The original list: #temp#
  22. </CFOUTPUT>
  23. <!--- now, insert an item at position 1--->
  24. <CFSET temp2 = ListPrepend(Temp, "my Inserted Value", ",")>
  25.  
  26. <CFOUTPUT>
  27. <P>The changed list: #temp2#
  28. <BR><I>Note that <B>#first_item#</B> has moved from 
  29. position one of the list to position two.</I>
  30. </CFOUTPUT>
  31.  
  32. </BODY>
  33. </HTML>       
  34.   
  35.