1 2 Previous Next 16 Replies Latest reply on Mar 31, 2013 10:21 AM by woo

    Tournament Bracket

    woo

      Title

      Tournament Bracket

      Post

           Hello,

           I need to build a tournament bracket just like the March madness style that when click on a name the name moves on to next level bracket. So, if A an B is competing and by clicking the winner, the winner moves up to next level field on the bracket.

           Thank you for the help.

           Woo

        • 1. Re: Tournament Bracket
          philmodjunk

               Simple to describe at the interface level, but not so easy to implement "under the hood". To begin with, it depends first on what you have for a data model.

               I once set up a Filemaker Database for an "AWANA Grand Prix"--that organization's version of scouting's Pinewood Derby. Cars raced on a 4 lane track and a single winner advanced to the next bracket. And I used a mouse click on the winning entry to advance it like you describe here.

               To make this happen, I set up a form view layout with multiple portals, using button setup.. to change the fields in the portal row into buttons. I used a combination of relationships and portal filtering to control which entries appeared in a given portal. Clicking the button performed a script that changed values in either a match field or in a field used in a portal filter expression to "advance" the winning entry.

          • 2. Re: Tournament Bracket
            woo

                 Thank you for the reply. 

                 Do you have an example of that button script?  

            • 3. Re: Tournament Bracket
              philmodjunk

                   Not on hand.

                   It can be as simple as:

                   Set Field [PortalTableOccurrence::Bracket2 ; 1 ]

                   Bracket2 might be a match field in the relationship used for the Bracket2 portal. It could also be referenced in a portal filter expression, but then you have to do some extra stuff to get the filtered portal to update after the script modifies the field value.

                   On the other hand, the set field step could modify a field in the Parent record to get this result as well.

              • 4. Re: Tournament Bracket
                woo

                      

                     So far, I have a portal with eight names listed from my main data base connected through relationshp.

                     I do need to create second portal that winners will moved in to by clicking a button?

                • 5. Re: Tournament Bracket
                  philmodjunk

                       Exactly.

                       Each bracket to which winners advace would be a different portal. In my use of this appoach, I had 4 portals on the layout with 4 entries each to represent the "flight 1" initial heats. My mouse clicks caused one of 4 single row portals to update to show the winner for each initial heat. Clicking one of these winners moved them to a 9th single row portal to show the overall winner for that "flight" of 16 initial entrants.

                       By using one row portals for the advancing entrants, I was able to draw lines on my layout tool to contsruct my tournament brackets.

                  • 6. Re: Tournament Bracket
                    woo

                         I am having trouble understanding your sample scrip button.

                    Set Field [PortalTableOccurrence::Bracket2 ; 1 ]

                    Can you explain how I can substitute my tables into your scrip?

                    I can't find  PortalTable Occurrence? 

                    Thank you

                    • 7. Re: Tournament Bracket
                      woo

                           Can you help with a scrip button that when button is clicked, the name on portal roll 1 moves to the portal roll 8?

                           I am new at write scrips

                           woo 

                      • 8. Re: Tournament Bracket
                        sparrow_design

                             Howdy Tournament-folk,

                             Using Portals would seem the obvious answer for this puzzle. However, repeating fields wioth one single table (one record per tournament) could also easily be employed as such:

                             Create 1 Repeating Field with 16 repeats = "Bracket_1"

                             Create 1 Repeating Field with 8 repeats = "Bracket_2"

                             Create 1 Repeating Field with 4repeats = "Semi_Finals"

                             Create 1 Repeating Field with 2 repeats = "Final"

                             Create One field, non-repeating = "Winner"

                             You could have used 1 Sinlge Repeating firls for ALL of the above, but makes the Scripting a bit more difficult.

                             Place 4 copies of field on left hand side of your Layout, each showing 4 repetitions...1st one = 1-->4, 2nd one = 5-->8, etc...so all 16 reps are displayed aloing left.

                             Fill in the Names of the Participants in first 16 repetitions. This would represent ALL Entrants in competition.

                             Create a new script that Will by Attached as OnEnter to the "Bracket_1" fields on your layout..should read like this:

                              

                        // BEGIN SCRIPT Name = Tournmanet Table . onEnter Trigger . Set Names into Bracket_2

                         Set Variable [ $_name ; Value = GetActiveFieldContents ]

                         If [ not Isempty ( $_name )

                           Set variable [ $_rep ; Value = Valuecount ( List ( TournamnetTable::Bracket_2 ) ) + 1 ]

                           Set Field [ Field = TournamnetTable::Bracket_2[$_rep], Value = $_name ]

                         End If

                         Exit Script[]

                        // END SCRIPT

                              

                             Set up a separate occurance of the bracket_1 field for adding/removing Entrant names, OR add a global variable to script that recognizes when you DON'T want the script to process (allow editing), then set THAT global variable before entring fields for editing purposes. 

                              

                             Now, create 2nd script to move names from "Bracket_2" to "Semi_Finals" - base it on same logic as first Script...just change the names of fileds in script steps Set Variable $_rep, and Set Field. And so on, and so on...

                              

                             The last script 'Move Name into Winner' can use same script logic WITHOUT the $_rep variable involved at all.

                              

                             Aplogies if I missed something obvious in your needs, or in my solution. 

                             Cheers,

                             - David

                              

                        • 9. Re: Tournament Bracket
                          sparrow_design

                               Here is modified Script that accounts for WHICH Bracket_2 names should fall into after clicking them - so they end up next to each other form same starting group:

                               -David

                          Set Variable [ $_name ; Value = GetActiveFieldContents ]

                          Set variable [ $_num  ; Value = GetActiveFieldRepetition ] // NEW

                          If [ not Isempty ( $_name )

                             Set variable [ $_rep ; Value =

                                Case (

                                 $_num < 5 and isempty ( TournamnetTable::Bracket_2[1] ) ; 1 ;

                                 $_num < 5 isempty ( TournamnetTable::Bracket_2[2] ); 2 ;

                                 $_num < 9 isempty ( TournamnetTable::Bracket_2[3] ); 3 ;

                                 $_num < 9 isempty ( TournamnetTable::Bracket_2[4] ); 4 ;

                                 $_num < 13 isempty ( TournamnetTable::Bracket_2[5] ); 5 ;

                                 $_num < 13 isempty ( TournamnetTable::Bracket_2[6] ); 6 ;

                                 isempty ( TournamnetTable::Bracket_2[7] ); 7 ;

                                 isempty ( TournamnetTable::Bracket_2[8] ); 8 ;

                                 "" // Bracket_2 names already filled

                                ) // end case

                             ] // end set variable

                             Set Field [ Field = TournamnetTable::Bracket_2[$_rep], Value = $_name ]

                           End If

                           Exit Script[]

                                

                               Cheers,

                                

                               -David

                          • 10. Re: Tournament Bracket
                            woo

                                 Wow! ok I will try this 

                                 Thank you David

                                 woo

                            • 11. Re: Tournament Bracket
                              philmodjunk

                                   It's your solution, but I would not recommend using repeating fields for this.

                              • 12. Re: Tournament Bracket
                                woo

                                     I would like to use the portal solution since I am already working with the portal, can you help me with the button scrip?

                                • 13. Re: Tournament Bracket
                                  sparrow_design

                                       woo,

                                        

                                       I have not seen your 'portal' setup, so I just threw together a Demo file using Portals instead of Repeating Fields (though THAT would be alot easier, not sure why Phil doesn't reccomend here, that is, beyond ALL the normnal reasons!) - hope this helps...Screenshot for basic setup/scripts used is attached as well below.

                                       Here's a link to download the Demo file: https://www.dropbox.com/s/7p6xqg18sjbxpfv/Tournament.fmp12

                                       Cheers,

                                       -David

                                  • 14. Re: Tournament Bracket
                                    philmodjunk

                                         All too often, repeating fields lack flexibility in ways that related tables of data do not.

                                    1 2 Previous Next