5 Replies Latest reply on Apr 20, 2012 2:19 PM by Tucker

    Grandchild Portal

    Tucker

      Title

      Grandchild Portal

      Post

       I have 3-tables: Company, Contacts , ContactEmail. They are related - Parent, Child, Granchild respectively.

      I have a layout based on Company with a portal on the first tab of a tab control listing all Contacts (child) of the Company (parent).

      On the second tab I have a notes field for a specific contact (the one selected on tab 1). This is possible because I created a new table occurance of Contacts & a global field in Company (g_SelectedContactID). The Comany table is joined to the new table occurance (ContactsGlobalFilter) via g_SelectedContactID -<-__pkContactID.

       There is also a script that triggers on exit of a contact on tab 1:  Set Field [Company::gSelectedContactID ; Contact::__pkiContactID].

      All of that works without any issues, only because it is what Phil suggested!

      Now I want to add some grandchild fields to portal tab#3. Here's what I've done and correct me if it's wrong.

      I reated a new table occurance of ContactsEmail & a global field in Company (g_SelectedContactEmailID). The Comany table is joined to the new table occurance (ContactsEmailFilter) via g_SelectedContactEmail -<ContactEmailFilter::__pkContactID.

       There is also a script that triggers on exit of a contacts on tab 1:  Set Field [Company::gSelectedContactEmail; Contact::__pkContactID].

      This works but I've noticed something strange. I placed ContactsEmailFilter::__pkEmailFilterID in the 3rd tab and every time I create a new email message the number increases (as it should). However, when I look in the ContactsEmail table all of the message entries have the same __pkContactEmail ID.

      Any ideas on why this is happening? I was expecting that the actual grandchild table would generate a new pk with every new entry but this only happens in the grandchild table occurance.

      Thank You.

        • 1. Re: Grandchild Portal
          philmodjunk

          All of that works without any issues, only because it is what Phil suggested!

          If memory is accurate, that's not quite what I suggested. I believe that I suggested creating a new notes table linked by contact ID so that the notes tab could use a portal to list multiple notes records for a selected contact instead of just a single note record as you have here.

          How is __pkContactEmail ID defined in Manage | Database | fields? Is it set up as an auto-entered serial number? (__pk stands for primary key and this is usually set up in a FileMaker database as a serial number field, though filemaker 12 offers a viable alternative in one of its new features.)

          • 2. Re: Grandchild Portal
            Tucker

            yes it is defined as a pk withe serial number  

            • 3. Re: Grandchild Portal
              philmodjunk

              I had to re-read you earlier post before I spotted it:

              The Comany table is joined to the new table occurance (ContactsEmailFilter) via g_SelectedContactEmail -<ContactEmailFilter::__pkContactID.

              Shouldn't be a __pk field there. It should be a foreign key. Take a look at your relationship and see what field is actually used there. I suspect it's the __pkContactEmail ID instead of the _fkContactID field that should be here. I don't see any other way you can be getting multiple records with the same value in __pkContactEmail ID.

              • 4. Re: Grandchild Portal
                Tucker

                 I checked and the connection it is actually from Company to the TO ContactEmailFilter::g_SelectedContactEmail -<ContactEmailFilter::__fkContactID.

                 

                 

                What I have noticed is that every new rocord in table ContactsEmail carries the same pk number while the table occurance ContactsEmailFilter adds 1 to the pk in it with every new record. I do have - "Allow creation of records..." checked in the relationships (on the ContactEmail table side as well as the ContactEmailFilter table).

                 

                • 5. Re: Grandchild Portal
                  Tucker

                  The granchild table is now incrementing the pk by one with each new entry. So it appears to be working.

                  One odd thing and maybe it has no bearing on all of this. All of the fields on the 3rd. potal tab stem from the TO of the main table. While testing I placed the pkID field from the TO and it shows the correct pk value. I also placed the pk field from the original grandchild table in the 3rd. tab. It always displays the same value (no increments with new records). However when I look directly at the main table it comes from, the values in there show increments!

                  Very strange! Bottom line is that the data works! Thanks.