7 Replies Latest reply on Sep 17, 2014 10:12 AM by BretJuliano

    Showing Related Records in Portals

    BretJuliano

      Title

      Showing Related Records in Portals

      Post

      Hi all, I am completely new to FMP, I am in the middle of building my first application but I am having some trouble getting basic functionality to work. I am trying to get related Forms to show in the portal at the bottom of the page.

      I have a separate table ("forms") with forms that are tied to the patients records.

      In my manage database relationship window, there are the tables "patients" and "forms." I have a primary key "Patient ID" in the Patients table and also have the "Patient ID" set as a foreign key in the Forms table. Also in the Edit Relationship box, both sides of the equation have the "Allow creation of records in this table via this relationship" checkbox checked.

      Nothing is showing at all. Any ideas on why this might be?

      Screen_Shot_2014-09-09_at_12.27.21_PM.png

        • 1. Re: Showing Related Records in Portals
          philmodjunk

          There are no fields from forms or any other table in your portal row. Thus the portal will always be empty. Use the field tool to drag and drop onto the empty portal row shown and select some fields from forms for inclusion in this portal row. (And "allow creation..." is not needed in order for data to appear in the portal.  "allow creation for the portal's table occurrence is needed if you want a blank "add row" to appear in your portal where you can enter data into fields and by doing so create a new related record in the forms table.

          • 2. Re: Showing Related Records in Portals
            BretJuliano

            Ah that makes so much sense! So would something like this be the proper setup? Also, is there a way to make the related fields in the portal on be static and not dynamic?

            • 3. Re: Showing Related Records in Portals
              philmodjunk

              The fields have to be within the portal row and "owned" by the portal. (when you move the portal, the portal row fields move with the portal.)

              What I see has the field labels placed where you should have the fields. The field labels should be located above the top border of the portal.

              You might want to delete this portal, add a new portal to the layout and follow the steps of the portal setup wizard. There's a point where a dialog opens up for you to select the fields to be placed in your portal and the wizard will place them for you. You can then adjust size and relative position after the fact if needed.

              • 4. Re: Showing Related Records in Portals
                BretJuliano

                Ok, I've got one more question on this, in Browse Mode, I added Previous and Next buttons to navigate between the different records, is there a way to make the portal information change when the record changes? Currently it's showing all of the related table information for all persons.

                • 5. Re: Showing Related Records in Portals
                  philmodjunk

                  Then you had better check the definition of the relationship linking these two tables.

                  If you have this relationship:

                  Patients::__pkPatientID = Forms::_fkPatientID

                  and your layout is based on Patients, then the portal should only list records for the current Patient and changing records should result in this portal listing a different set of forms automatically as it update so only list the forms for this different patient record.

                  For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained

                  Caulkins Consulting, Home of Adventures In FileMaking

                  • 6. Re: Showing Related Records in Portals
                    BretJuliano

                    Okay, that's how the relationship is setup, as best as I can tell.

                    I understand the logic of the first post, but I still must have something setup incorrectly because, as you can see from the left side of the screenshot, the patient currently open doesn't have the right "Media" attached to them. The story title is "Leo's Eye" which should is connected to another patient record. Also, is there anything that needs to be set in the portal's "Filter records" section?

                    • 7. Re: Showing Related Records in Portals
                      BretJuliano

                      Nevermind, I had an old window open with two patients sharing the same ID, which i don't know how that happened.

                      When i went in and duplicated the patient, Leo, it assigned a new ID and when I attached a form to his ID it stayed.

                      Now when I switch between patients, the portal items change with the patients.