Ok this is a pretty basic but elaborate problem I have a list contriving of the ID's of some teams, i want to create a method that can create a fixture list so that every ID plays each other regardless of how many IDs are in the list. For example: tid_list = "1,2,3,4" to produce 1 v 2 1 v 3 1 v 4 2 v 3 2 v 4 3 v 3 3 v 4 Brains a bit frazzled so sorry if the explaination is a bit fuzzy, any one had any experience with this and recommend a way of doing it. I'm currently attempting to do it by cycling through the lists with loops and incrementing the ListGetAt value but not having much luck.
The "3 v 3" is a typo right? Maybe something like this.. <cfset tid_list = "1,2,3,4"> <cfoutput> <cfloop from="1" to="#listLen(tid_list)#" index="x"> <cfloop from="#(x+1)#" to="#listLen(tid_list)#" index="y"> #x# v #y#<br> </cfloop> </cfloop> </cfoutput>
Thats spot on thanks, my poor brains taken a hammering these past couple of days and just couldn't grasp it. Thanks again, although there are certain conditions i'm going to have to apply to the results of that list so i may be back here a bit later on
Yes, we've all had those days! If the team ids come from a db table I was almost going to suggest using a cross join. But you've got to be very careful with those. They can generate very large result sets. So only use them if you know what you're doing