1 Reply Latest reply on Jun 21, 2013 9:16 AM by philmodjunk

    extending a relationship

    ingredlee

      Title

      extending a relationship

      Post

           I have a many to many relationship defined with (id1, id2, comment) Id1 and Id2 refer back to the same Inventory table. I want to set up a portal that will display the inventory row regardless of whether it exists as Id1 or Id2. I can select the rows I want with an extended found set or a SQL UNION statement. But I am unsure how to apply this to a relationship in a portal.

        • 1. Re: extending a relationship
          philmodjunk

               Option 1:

               Get rid of the two separate fields. Replace them with a join table to faciltate a many to many relationship. This is the most flexible way to set up a many to many, but also is likely to require more design changes on your part to implement:

               YourTable----<YourTable_Inventory>-------Inventory

               YourTable::__pkYourTableID = YourTable_Inventory::_fkYourTableID
               Inventory::__pkInventoryID = YourTable_Inventory::_fkInventoryID

               Option 2:

               Add a calculation field, cIDList, with this expression: List ( id1 ; id2 ) and select Text as the result type.

               Then relate your tables like this:

               YourTable::cIDList = Inventory::__pkInventoryID

               That's much simpler to set up, but also can be a lot less flexible.