Ian Skinner wrote:
> Then enhance it so that it can expand the pattern to more then 3
> values per column. As mentioned in an earlier response, my pattern
> always has three columns, but it would be nice if I could have N
> possible values per column.
>
The original assumed the same number of columns as values in the
list...this disconnects the two...I think it works, but I didn't put
much effort into checking...
<cfset thelist = "0,8,16,32,64" />
<!---Do this to 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 y = -1><!---The direction we are starting in in the list--->
<cfset x = 2><!---The position we are starting with--->
<cfset p = 3><!---Number of columns--->
<cfset p1 = listlast(thelist)>
<cfloop index="lp" from="2" to="#p#">
<cfset "p#lp#" = listfirst(thelist)>
</cfloop>
<cfoutput>
<cfset l = listfind(thelist,variables["p#x#"])>
<cfloop index="lp" from="1" to="#p#">#variables["p#lp#"]#.</cfloop><BR>
<cfloop index="n" from="1" to="50"><!---however many times you want to
iterate--->
<cfset nn = 1>
<cfloop condition="((y LT 0 AND l IS 1) OR (y GT 0 AND l IS
listlen(thelist)))">
<cfset nn = nn + 1><cfif nn GT len(thelist)>There seems
to be an
infinite loop.<cfabort></cfif><!---just in case my logic was off--->
<cfset y = y * -1>
<cfif x IS 1><cfset x = p><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="#p#">#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:261868
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4