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

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