3 Replies Latest reply on Apr 29, 2013 6:54 AM by philmodjunk

    Backward N:M relation in one portal

    J.Dikken

      Title

      Backward N:M relation in one portal

      Post

           I would like to display in one portal also backward relations as well as forward relations.

           For instance:

           Consider a file with every record having data of one person, and a second file with connection-records registering this person knows different persons in a certain type of relation (parent, child, married) in a layout with a portal showing persons B,C,D who that person A knows.

           Go to a different record (person D). The portal shows no reverse connection D to A.

           Is there logic that the connection-record A to D also generates display reverse connection D to A, this showing in the same portal?

        • 1. Re: Backward N:M relation in one portal
          philmodjunk

               Are these the relationships that you are picturing?

               People---<People_Join>-----People2

               People::__pkPeopleID = People_Join::_fkPeopleID1
               People2::__pkPeopleID = People_Join_fkPeopleID2

               where People and People2 are Tutorial: What are Table Occurrences? with the same data source table?

               And if you use a portal to People_Join on a People layout to link "John" to "Fred" with "father" as the relationship, you want "john" listed as a relative of "Fred" when you pull up his record?

               That can be done, but it requires two records in the Join table with the ID values swapped. A script can be used to automatically produce the "mirror record" in the Join table.

          • 2. Re: Backward N:M relation in one portal
            J.Dikken

                 Thank you for reply.

                 I was wondering if it could be done in one record of People_Join, instead of two, using a field with two repetitions for the peopleID and two repetitions in the description of the relationschip-field in People_Join, with logic to depict the second relationship-description if People is related to the second repetition of PeopleID? (or any other solution using one record instead of two.

                 This way the chance of letting a relationship exist as the counterrelationschip is deleted, is reduced. This is sometimes possible if scripts are not good performed in web-solutions.

            • 3. Re: Backward N:M relation in one portal
              philmodjunk

                   As long as you do not use script triggers this script should work equally well in web published solutions as it does not require any steps that are not web compatible.

                   Whether you use two records, two repetitions or two sets of link fields, you'd need some way to automate recoring the second pair of matching values. It's certainly an interesting idea and one that you can experiment with to see how it works.