Try this out... <cfset thelist = "0,8,16"> <!---Seed the list with values, by default the first element is the last value in the list, and all of the others are the first value in the list, could also be set manually---> <cfset p1 = listlast(thelist)> <cfloop index="lp" from="2" to="#listlen(thelist)#"> <cfset "p#lp#" = listfirst(thelist)> </cfloop>
<cfset y = -1><!---The direction we are starting in in the list---> <cfset x = 2><!---The position we are starting at---> <cfoutput> <cfset l = listfind(thelist,variables["p#x#"])> <cfloop index="lp" from="1" to="#listlen(thelist)#">#variables["p#lp#"]#.</cfloop><BR> <cfloop index="n" from="1" to="50"><!---however many times you want to iterate---> <cfset c = 1> <cfloop condition="((y LT 0 AND l IS 1) OR (y GT 0 AND l IS listlen(thelist)))"> <cfset c = c + 1><cfif c GT len(thelist)>We are looping, no more changes seem possible.<cfabort></cfif> <cfset y = y * -1> <cfif x IS 1><cfset x = listlen(thelist)><cfelse><cfset x = x - 1></cfif> <cfset l = listfind(thelist,variables["p#x#"])> </cfloop> <cfset l = l + y> <cfset "p#x#" = listgetat(thelist,l)> <cfloop index="lp" from="1" to="#listlen(thelist)#">#variables["p#lp#"]#.</cfloop><BR> </cfloop> </cfoutput> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261810 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4