10 Replies Latest reply on Apr 7, 2015 2:53 PM by philmodjunk

    Display items from same table in tabbed layout

    ScottJames_1

      Title

      Display items from same table in tabbed layout

      Post

      Hi, I am new to using Filemaker Pro and appreciate any assistance even if it's directing me to a more suitable forum for such issues. 

      I have a table with dog details on it. Each dog has a serial no ID. I wish to display other dogs from the same table on the layout as 'related dogs'. I want to display the picture and the name but cannot find a way to do this. 

      For example: Dog 1 has a picture and other details shown on the first tab and another tab named 'Related' features the pictures and names of dogs 7 & 12.

      Eventually, I will want to add the ability to click through to the featured dogs from this tab.

      In the relationships area of 'Manage Database' it wants me to create another instance of the same table (I'm guessing this is to prevent a feedback loop) I have done this but cannot figure out how to display the related dogs. I can get the names to appear but the picture field shows the main dog's picture again...

      If anyone can offer any help I'd be very grateful.

      Many Thanks,

      Scott 

        • 1. Re: Display items from same table in tabbed layout
          philmodjunk

          Is the picture in the same table as the names? If so, the same process that you are using to add the name fields from the newly related table occurrence (Instance) will work to show the picture. You can click any field while in layout mode and see the field's table occurrence name as the text to the left of :: in "Display Data From" on the Inspector's data tab.

          • 2. Re: Display items from same table in tabbed layout
            ScottJames_1

            Hi, Thanks for responding. I have obviously set something up wrong as the picture shown is the same as the main picture rather than a related dog...

            I have attached a screen shot of the table set up. This is quicker than a rather wordy explanation. If you get the time to look at it and respond I'd be really grateful.

            Thanks,

            Scott

             

            • 3. Re: Display items from same table in tabbed layout
              philmodjunk

              I don't see how that will work for any of your fields where you want to show data about a different dog.

              On which of the above 3 table occurrences is your layout based? (This will be the name shown in Layout Setup | Show Records from.)

              • 4. Re: Display items from same table in tabbed layout
                ScottJames_1

                I don't see how that will work for any of your fields where you want to show data about a different dog

                Thanks for the response PhilModJunk. I thought this might be the case... I know exactly what I'm trying to do but am struggling to understand how Filemaker pro relates the items to one another. I have put together this diagram of what I was trying to achieve in the hope that someone might be kind enough to make suggestions as how to turn it into a reality...

                Thanks in advance for any feedback.

                Scott

                • 5. Re: Display items from same table in tabbed layout
                  philmodjunk

                  Will there always be a maximum of two other dogs (mother and father maybe?) to show?

                  Or will the number be variable?

                  If it's just one or two, you can use this data model:

                  Dogs|Parent1------<Dogs|Progeny>-----Dogs|Parent2

                  Dogs|Parent1::__pkDogID = Dogs|Progeny::_fkDogParent1ID
                  Dogs|Parent2::__pkDogID = Dogs|Progeny::_fkDogparent2ID

                  There is only one table here, but three table occurrences of that one table.

                  If the number of related dogs records is varible and could be more than two, then you'll need a different data model that uses a join table.

                  PS. and while I used the term "parent" here, this same set up still works even if the relationship is not geneological.

                  • 6. Re: Display items from same table in tabbed layout
                    ScottJames_1

                    Thanks PhilModJunk, Unfortunately, there can be any number of related dogs - They might be related or just associated.

                    Eventually, I'd like to link the customers to the numerous dogs too so I can put in their details and pull them up on every relevant dog. The whole reason I wanted to use a relational database is so I can enter information once and tie it to numerous entries. If I change an address I want it to update everywhere. HTML vs PHP kind of approach.

                    I would like to end up with something similar to the following:

                    Dog 1's Record shows all relevant info and related dogs 2, 3, 4, 7 & 9

                    Dog 2's Record shows all relevant info and related dogs 1, 3, 4, 7 & 9

                    Dog 3's Record shows all relevant info and related dogs 1, 2, 4, 7 & 9

                    etc,etc. I hope this makes sense. I don't know if diagrams are helpful and considered 'good etiquette' on forums. If they are acceptable I will work on more as they save a thousand words.

                    Any response will be greatly appreciated.

                    Thanks, Scott

                    • 7. Re: Display items from same table in tabbed layout
                      philmodjunk

                      Your description of wanting to have one tab panel of your tab control for each such tab won't be very practical then as you will have a fixed number of tab panels but will not have a fixed number of associated dogs. There are alternative methods you might use.

                      Here's the Join Table alternative:

                      Dogs-----<Join>----Dogs|Associated

                      Dogs::__pkDogID = Join::_fkDogID
                      Dogs|Associated::__pkDogID = Join::_fkAsstdDogID

                      Dogs|Associated is a second Tutorial: What are Table Occurrences? of Dogs.

                      A portal to Join placed on your Dogs layout will list all associated dogs. Fields, including a container field for the picture, could be included from Dogs|Associated in the rows of that portal. (You can reduce the number of portal rows and increase the height of a portal row to get more of a "mini form view" then the default "mini table view" format for a portal.)

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

                      • 8. Re: Display items from same table in tabbed layout
                        ScottJames_1

                        Hi PhilModJunk, Thanks once again for your response but I'm afraid I'm uncertain as to your exact meaning in some of the explanation - namely 'A Portal to Join placed on your Dogs layout...' Does this mean I create a portal on the Dogs layout attached to the Join Table?

                        It's not behaving the way I was expecting. In an attempt to best understand your teachings and to simplify in general, I have stripped it all down to just the elements listed in your example. When I add a portal to the Dogs table added to the join table I can work on the portal until I switch back to preview and then there is nothing displayed.

                        Perhaps you might tell me where I've gone wrong?

                        • 9. Re: Display items from same table in tabbed layout
                          ScottJames_1

                          To PhilModJunk: I'm presuming there needs to be something like a Family No (Unique last name) to tie the dogs together so they know which dogs are related? I had thought about creating a 'Family' table that included the Serial No function to tie the related dogs to each other. I thought I might use that to also tie individual family members to the dogs. I cannot see why the portal fails to show anything - Not even an empty box. I have included a screen shot to illustrate the point. I'm sure it's a very basic newbie mistake.

                          I read the article you composed for explaining the primary / foreign key and found it very clear. Thanks. 

                          • 10. Re: Display items from same table in tabbed layout
                            philmodjunk

                            You are correct that the portal would show "Join" in the show related records from drop down in portal setup.

                            You would not have a common "family value" with this method, but you do have create records in the Join table before the records are linked and you can see any data in your portal.

                            The simple "beginner level" approach:

                            Enable "allow creation of records via this relationship for Join in the dogs to join relationship. (double click the relationship line.)

                            The Format _fk_Dog_Associated... with a drop down list. Set up a use values from field value list of values from Dogs where Field 1 is __pk_Dog_ID and the second field would be the dog's name. (Note this name has to be unique. Sometimes you have to use a text field with an auto-enter calculation that combines info from several fields and that has a "unique values" validation rule specified.)

                            You can then select a dog in the portal row using this value list. This act both creates a new record in Join and automatically links it to the current record on your Dogs layout.

                            There are more sophisticated ways to set this up that can be much more user friendly when it comes to finding and selecting dogs to link in, but you'll need to set up this method first to confirm that everything is set up correctly.