1 Reply Latest reply on Jul 2, 2012 9:37 AM by philmodjunk

    Linking Tables



      Linking Tables


      I am building a solution for a brokerage where contacts can buy /sell stuff with other contacts. I have two tables - one called contacts and the other items. I am trying to create a relationship between them in such a way that I can display a portal of all contacts to the left of a particular item.

      I will then write a script that clicking on a particular contact will assign it to the item. However I cant think of a meaningful way of constructing the relationship between items / contacts.


      I have upload a screen shot of the layout and browse mode, and relationship diagram to :-




      curretly I have contact_id__ x item_id





        • 1. Re: Linking Tables

          What you describe is both a many to many relationship. A contact can be linked to many different items and an item can be linked to more than one contact.

          You'd be best served by a join table linking items to contacts like this:


          Items::__pkItemID = Item_Contact::_fkItemID
          Conteacts::__pkContactID = Item_Contact::_fkContactID

          With this set up, you can place a portal to Item_Contacts on the Items layout and you can include fields from Contacts in the portal row to provide details (such as their names) about each contact linked to that product.

          Here's a demo file that links contacts to events in this manner: https://www.dropbox.com/s/oyir7cs0yxmbn6i/ManyToManywDemoWExtras.fp7

          What I have described here is called the "basic setup" in the demo file.