4 Replies Latest reply on Nov 13, 2014 10:38 AM by CamillaBarker

    Query Relationships / Second TO

    CamillaBarker

      Title

      Query Relationships / Second TO

      Post

      Hello I am a beginner to Filemaker pro and am having a little trouble creating the right type of relationship to achieve one of my goals. As you can see in the image, I have ARTISTS relating via ARTISTGALLERIES to GALLERIES, then I also have ARTISTS relating directly to ARTIST PHOTOS. 

      In my ARTISTS layout / context I can show a portal showing all the galleries relating to the artist and another portal showing all the photos relating to the artist. In the ARTIST PHOTOS table / layout / context and therefore also in the portal showing the photos in the ARTISTS layout / context I want to be able to specify which gallery each photo comes from - as the artist can have many galleries.

      As one ARTIST PHOTO can only belong to one GALLERY but one gallery can have many ARTIST PHOTOS, I tried to link a pkgallery from GALLERIES to an fkgallery in ARTIST PHOTO but I was invited to create another table occurrence of ARTIST PHOTOS. I did this but cannot seem to be able to then specify in ARTIST PHOTOS which gallery any photo belongs to. I tried to do it how I did everything else by creating a drop down field for fkgallery showing the serial number with also the gallery name and then another field with the gallery name. Either I manage to choose from the drop down list but the gallery name field won't change accordingly or there just isn't any drop down list. I also tried linking a second table occurrence of ARTIST PHOTOS to ARTISTGALLERIES via pkartistgalleries and fkartistgalleries but that isn't working either. 

      Clearly I haven't grasped how to manage a second table occurrence, or I'm doing it all wrong and don't actually need one. Either way can anyone help me resolve my problem please?

      Screen_Shot_2014-11-13_at_15.39.48.png

        • 1. Re: Query Relationships / Second TO
          philmodjunk

          Looks like you need this relationship for that second occurrence:

          ArtistGalleries::_fkArtistID = ArtistPhotos|Gallery::_fkArtistID AND
          ArtistGalleries::_fkGalleryID = ArtistPhotos|Gallery::_fkGalleryID

          In your portal to ArtistPhotos, you can set up ArtistPhotos::_fkGalleryID with a value list for selecting the gallery currently showing that photo.

          • 2. Re: Query Relationships / Second TO
            CamillaBarker

            Thank you very much Phil for your quick reply. I think I'm still getting something wrong. Did you mean:

            I create a second occurrence of the ArtistPhotos table, call it ArtistPhotosGallery and then link it as you suggest to the ArtistGalleries Table? I did this as you can see in the image. In the portal to ArtistPhotos as you suggest I set up a value list for selecting the gallery which does seem to all work fine. What eludes me still is that I'd like to display the gallery name in full and not just the ID in the portal. I did what has worked until now which is just to tell a field show "GalleryName" from the GALLERIES table however when I select the right gallery from teh drop down list in one field, this last mentioned field does not change accordingly...

            Might you have any tips please?

            • 3. Re: Query Relationships / Second TO
              philmodjunk

              If you link an occurrence of Galleries to ArtistPhotos by galleryID fields, you can use fields from this new occurrence in your portal row to show the Gallery name or any other data about the Gallery showing that photo. You might not need to do this if you set up your galleryID field in the portal as a popup menu.

              • 4. Re: Query Relationships / Second TO
                CamillaBarker

                Thank you Phil for being such a help - it all works now and I can end my day with a mini sense of triumph as it really was bugging me. Such a simple solution, but I just wasn't getting it, I really do appreciate your experience and help thank you. Great things these forums!