Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

nested loops

Featured Replies

I have 10 teams, I'm trying to write a script that will make a 9 week schedule such that every team plays each other once. Sounds like such and easy thing to write !!! I can easily populate all the fields, but making each match unique has got my brain all twisted. Anyone got any suggestions ?? thanks Ed

Making each match unique should be a combination of the two teams, maybe ID#'s or the Team Names if they are unique.

At the first team set a Unique Field to ID_Team & "-", then when you get to the team they are playing use Set Field to add the second team, ie. Unique Field = Unique Field & ID_Team.

Hi Ed,

It seems to me this would be best to use a script to populate related scheduled matchup records based on these rules:

1. A team should not get scheduled to play itself

2. A team should not play another team more than once

We can use nested loops to generate records in a join table for each combination of teams, so long as the creation won't violate those two rules.

Rule 2 brings us to a complication about the direction of the relationships used for the matchup. Using a join table we can add matchup records indicating that one team is scheduled to play another, but this join record will only indicate the scheduled matchup from one team's perspective, not both. We could create two join records for the scheduled matchup, one for each team's perspective, or we could try what I've done in the attached sample and use one join record, but viewed from two perspectives: Home matchups and Away matchups.

Check out the attachment and let me know if it still doesn't make sense.

Matchups.fp7.zip

This not easy at all - in fact it is quite complex. In addition to the match-ups, there needs to be a schedule. Not only cannot a team play against itself, it also cannot play twice in the same round of games.

I have tried a calculated approach which seems to work, though I haven't really tested it against varying circumstances, e.g. number of teams.

tournament.fp7.zip

Oh yea, forgot about the weeks thing. Back to the drawing board for my scripted approach. wink.gif

It's back to the drawing board for me as well - my calculations are wrong!

I can calculate either the correct match-ups, or the correct order of games - but not yet both at the same time...

Thanks for the link - I had a problem with his cycling in the "wrong" direction, but it helped.

I hope this is it.

tournament.fp7.zip

  • Author

Thanks guys, for all the imput, all great ideas. I have written down a solution using C, i just need to translate it into filemaker scripting. If i get it working properly, i will post it. Thanks again.

Ah .. ?? .. I thought I had finished this? Have you not seen my last attachment, or did you find a problem with it?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.