4 Replies Latest reply on Jul 27, 2013 8:32 AM by adhutchinson

    Sport League Manager with Fixture/Schedule Generator... Script Help



      Sport League Manager with Fixture/Schedule Generator... Script Help



           I am trying to build a League Manager Application for my Local Field Hockey Association.

           There are a total of 11 different leagues, based on Gender/Age Group/etc.

           I got some help from another Forum, and below is the script that did most of what I required.

      set error capture [ on ]
      #the layout you're on is Leagues
      set variable [ $hometeamIDs; Value:List ( teams | list::ID ) ]
      set variable [ $awayteamIDs; Value:List ( teams | list::ID ) ]
      set variable [ $leagueID; Value:leagues::ID ]
      set variable [ $numberofteams; Value:ValueCount ( $hometeamIDs ) ]
      set variable [ $count_outer; Value:1 ]
      Go to layout [ “matches” (matches) ]
           set variable [ $currenthome; Value:GetValue ( $hometeamIDs ; $count_outer ) ]
           set variable [ $count_inner; Value:1 ]
                   set variable [ $currentaway; Waarde:GetValue ( $awayteamIDs ; $count_inner ) ]
                   If [ $currentaway ≠ $currenthome ]
                    New record/request
                    set field [ matches::hometeamID; $currenthome ]
                    set field [ matches::AwayteamID; $currentaway ] 
                    set field  [ matches::leagueID; $leagueID ]
                  End If
                 Exit Loop If [ $count_inner ≥ $numberofteams ]
                 set variable [ $count_inner; Value:$count_inner + 1 ]
                 End Loop
           Exit Loop If [ $count_outer ≥ $numberofteams ]
           set variable [ $count_outer; Value:$count_outer + 1
      End Loop
      Go to lay-out [ original layout ]


           But!!  This script creates a full Home & Away Schedule for all of the games in the League's fixture, without game dates or time... Which leaves me with three problems

           1) The fixtures are created so that is cycles through the teams, creating all of that teams home fixtures then moving on.  This leads to the problems in #2 & #3

           2) I need to automate the dates from a Field called Start Date. Games are held weekly and take place on the same day, every Round/Week.  Each Team is only allowed one game per Round/Week.

           3) Some competitions are too big to host a full Home & Away Schedule, we are limited to between 20-28 weeks of play, inc. playoffs, so the larger competitions would only play every other team once.

           For an even number of teams (say 16) this would mean an odd number of games (n_total=15), in which case, half the teams would play more than half of their games at home (n_home=8; n_away=7; n_total=15) and vice-versa (n_home=7; n_away=8; n_total=15)