home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows ListPrepend --->
- <HTML>
- <HEAD>
- <TITLE>ListPrepend Example</TITLE>
- </HEAD>
-
- <BODY>
- <H3>ListPrepend Example</H3>
-
- <!--- First, query to get some values for our list --->
- <CFQUERY NAME="GetParkInfo" DATASOURCE="cfsnippets">
- SELECT PARKNAME,CITY,STATE
- FROM Parks
- WHERE PARKNAME LIKE 'DE%'
- </CFQUERY>
- <CFSET temp = #ValueList(GetParkInfo.ParkName)#>
- <CFSET first_item = ListFirst("#temp#")>
-
- <CFOUTPUT>
- <P>The original list: #temp#
- </CFOUTPUT>
- <!--- now, insert an item at position 1--->
- <CFSET temp2 = ListPrepend("#Temp#", "my Inserted Value", ",")>
-
- <CFOUTPUT>
- <P>The changed list: #temp2#
- <BR><I>Note that <B>#first_item#</B> has moved from
- position one of the list to position two.</I>
- </CFOUTPUT>
-
- </BODY>
- </HTML>
-
-