I think I figured something out.  I found this chunk of code on Ray's blog.
http://www.raymondcamden.com/index.cfm/2009/11/17/Ask-a-Jedi-Round-robin-display-of-data
Thank you Ray as always!

And tweaked it out to model the table structure of a "round robin schedule".  
http://en.wikipedia.org/wiki/Round-robin_tournament 

Now I just need to take it and convert it to a query object or something like 
that so I can ask it Team 1 plays who in the 4th round?

<!--- team names --->
<cfset data = [ 
    ["team1", "team2", "team3", "team4", "team5", "team6", "team7", "team8", 
"team9", "team10"]
    ]>
        
<!--- number of rounds to play --->
<cfset rounds = 12>
  

<cfscript>
function render(arr) {
    for(var i=1; i<=arrayLen(arr); i++) {
        for(var x=1; x<=arrayLen(arr[i]); x++) {
            writeOutput(arr[i][x] & " ");
        }
    }
}
</cfscript>


<cfoutput>
#render(data)#
<p/>
</cfoutput>

<cfloop from="1" to="#variables.rounds#" index="ii">


<cfset movingItem = data[1][1]>
<cfset arrayDeleteAt(data[1],1)>
<cfset arrayAppend(data[1], movingItem)>


<cfoutput>
#render(data)#
<p/>
</cfoutput>
</cfloop>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357594
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to