1 Reply Latest reply on Mar 1, 2012 9:33 AM by philmodjunk

    Relationships and Portals

    JCPython

      Title

      Relationships and Portals

      Post

      hey guys!

      Im having some real trouble working with a relationship and portal...

      i have a table that keeps records of my reptiles:

      Record_ID - auto serial
      Record_Date
      Reptile_IDCode
      Reptile_Nickname

      Then I have a table that keeps track of different types of Morphs (color and pattern variations):

      Morph_ID - auto serial
      Morph_Name
      Morph_genetics

      so one reptile can have one or more different morphs related to it, on the form showing reptile records i would like to show a portal listing the morph(s) relating to that specific reptile.

      is there a way to have this listed on the main reptile form? will i need to create another instance of the morphs table? any help is much appreciated!

        • 1. Re: Relationships and Portals
          philmodjunk

          so one reptile can have one or more different morphs related to it,

          That "more" makes this a many to many relationship between reptiles and Morphs. A given Morph record can be linked to many Reptile records and a given Reptile record can be linked to more than one Morph record.

          That requires a join table to facilitate the many to many relationship:

          Reptiles----<Reptile_Morph>-----Morphs

          Reptile::Record_ID = Reptile_Morph::Record_ID
          Morphs::Morph_ID = Reptile_Morph::Morph_ID

          A portal to Reptile_Morph can be placed on your Reptile layout to list all Morphs identified for that reptile. Fields from the Morphs table can be included in this portal row to supply the needed details.

          In similar fashion, a portal to Reptile_Morph on the Morphs layout will list all Reptiles identified as having that Morph.

          Here's a demo file that illustrates a many to many relationship. Check out the "basic set up" first to see how you can set this up and then investigate the more advanced options if you are so inclined: http://www.4shared.com/file/dZ0bjclw/ManyToManywDemoWExtras.html