2 Replies Latest reply on Apr 16, 2014 10:41 PM by RichPompetti

    Create join records from checkboxes

    RichPompetti

      Title

      Create join records from checkboxes

      Post

           I have task-tracking database with three tables: Tasks, People, and a join table in between called Assignments.

           I'd like to have a way to assign a task to several people from a layout for the Tasks table. I could do that with just a portal to the assignments table where I can type in names, but I'd prefer to do it without typing.

           I'd like to figure out how to have a checkbox next to the name of everyone in the People table displayed on the Tasks layout. Checking a checkbox would add a record with the TaskId and PersonID to the joined Assignments table. Unchecking the checkbox would delete that record.

           I'm new to the many-to-many relationship paradigm that requires join tables and all the tutorials I've found online show using a portal to add records to the join table. Is it possible to do this simply with checkboxes?

      Screen_Shot_2014-04-15_at_12.34.11_PM.png

        • 1. Re: Create join records from checkboxes
          philmodjunk

               See the "check boxes" layout found in the following demo file. They are not really check boxes. They are buttons with conditional formatting setup to mimic the functionality of a check box. If you are using FileMaker 12 or newer, use Open from FileMaker's File menu to open this file and convert it to the newer file format.

          https://www.dropbox.com/s/oyir7cs0yxmbn6i/ManyToManywDemoWExtras.fp7

               Note: in FileMaker 13, the new "Hide Object When" setting in the Inspector could be used in place of conditional formatting to control whether the "x" in the "check box" appears or disappears.

          • 2. Re: Create join records from checkboxes
            RichPompetti

                 Thanks for the help!

                 The example still requires a portal and some scripting to manage the creation and deletion of the join records, but nothing too dirty. I had to alter my layout from horizontal to vertical list since there's no particularly graceful way to do a horizontal portal with varying-width text, but in the end, I'm pretty happy with the result. Using the same formula for the conditional formatted 'x' worked for the Hide Object When as well.

                 I appreciate the example; it got me to where I needed to be.