5 Replies Latest reply on Sep 5, 2011 9:19 AM by Vinny

    Combined List / Layout

    Vinny

      Title

      Combined List / Layout

      Post

      Hello,

      Say I have a DB with two tables: accounts & contacts.  accounts can have any number of contacts, and they are related by a key (ID) in the accounts and a foreign key in contacts.

      I would like to have a layout which shows, on the left, a list of contacts, and on the right, the form for editing a contact.  When the user clicks on the contact (or selects it) the related contact information (or form) shows up on the right.  The user can edit this form.

      It's kind of a hybrid approach that I think will make using the DB much easier.  Currently, I have a list view pop up when a user goes into the contacts section.  Then, when they select a contact, it navigates them to the contact edit screen where they can view / edit the details.  This seems like too many steps....

      Do I set up a layout for the contacts datails, and then add a portal of contacts on the left side?  Not sure how I would do this.

      Please let me know if you have any ideas.

      Thanks!

        • 1. Re: Combined List / Layout
          philmodjunk

          Use a form view to display a single contact record on your layout. Use a portal with an X based self join to list all contacts. Turn the field(s) in the portal into a button that performs a script that pulls up your contact record on the fields of the same layout.

          Define this relationship:

          Contacts::anyfield X AllContacts::anyField

          AllContacts is a second table occurrence you create in Manage | Database | Relationships by clicking Contacts and then clicking the button with two green plus signs. You can double click this new "occurrence box" to open a dialog where you can change the name. After dragging from one field in contacts to one field in Allcontacts to create a relationship, you can double click the relationship line to open a dialog where you can change = into the cartesian join operator (X).

          Your script can look like this:

          Go To Related Record [ Show only related records; From table: AllContacts; Using layout: <Current Layout> ]

          You can also use conditional formatting to choose a contrasting fill color with an expression like this:

          Contacts::ID = Allcontacts::ID

          So that the row you click stays "hilighted" in the portal when you select a contact by clicking a portal row. (To turn a portal row into a button, you can enter layout mode, select all fields in the row and then choose Button Setup... from the Format menu.)

          • 2. Re: Combined List / Layout
            Vinny

            Wow, Thanks Phil.  That sounds perfect!

            I'm glad I get to try out the cartesian join....I was wondering when that was going to come into play.

            Thank you!

            • 3. Re: Combined List / Layout
              kellymc

              I love this technique, but has anyone figured out a way to keep the portal from jumping back to the top of the list when you select a new record?

              • 4. Re: Combined List / Layout
                kellymc

                And here's an excellent answer:

                 

                http://forums.filemaker.com/posts/d6f3968c9a

                • 5. Re: Combined List / Layout
                  Vinny

                  Now that I have some data in my DB I found an issue with the combined portal view....if the current selected item is not toward the beginning of the list in the portal, the user can't see what is selected until they scroll down the portal...

                  In other words, the portal is not smart enough to know that the current selection requires scrolling down.

                  Is there any way to set the focus of the portal to the area where the current record is?