7 Replies Latest reply on Apr 1, 2014 7:19 AM by philmodjunk

    Creating Record to Table from Another Record in the Same Table

    TiffanyMulally

      Title

      Creating Record to Table from Another Record in the Same Table

      Post

           Hi.

           I am creating a database that tracks acts of plagiarism that have been caught. I have it set up with a table for info and one for the documents (this is the list of plagiarism, the course, the person, etc). In the documents table, I would like to track WHO the plagiarism was copied from. When I do this, I would like to automatically populate a new record with this information. 

           ie.

           Record 1:

           ID 2045 Thomas, Brian in Spring 2011 Intro to Business  | Paper taken from ID 3201 Frank, Michael in Fall 2010 Intro to Business

           Both students would need a record of the plagiarism and would like to be able to do it one layout. Possible?

           Thanks.

            

        • 1. Re: Creating Record to Table from Another Record in the Same Table
          philmodjunk

               It's possible. What you are describing is a "many to many self join" relationship. A relationship where one record in your table could link to any number of other records in the same table via an intermediary "join" table to manage the multiple linkages. (Several students could plagiarize the same student. One student could plagiarize multiple students...)

               Start with these relationships:

               Students|Source-----<Join>-----Students|Plagiarizers

               Students|Source::__pkStudentID = Join::_fkSourceStudentID
               Students|Plagiarizers::__pkStudentID = Join::_fkPlagStudentID

               Students|Source and Students|Plagiarizers are two Tutorial: What are Table Occurrences? with the same data source table.

               For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained

               You can place a portal to Join on the Students|Source layout to list and select  Students|Plagiarizers records for each given Students|Source record. Fields from Students|Plagiarizers can be included in the Portal to show additional info about each selected Students|Plagiarizers record and the _fkPlagStudentID field can be set up with a value list for selecting Students|Plagiarizers records by their ID field.

          • 2. Re: Creating Record to Table from Another Record in the Same Table
            TiffanyMulally

                 Thank you for responding so quickly...

                 So, in your example, are Students|Plagiarizers and Students|Source two different tables? 

                 I included a screenshot of my table relationship view. I am SJ_Documents as the join table... 

            • 3. Re: Creating Record to Table from Another Record in the Same Table
              philmodjunk

                   They are not. To repeat from my last post:

                   

                        Students|Source and Students|Plagiarizers are two Tutorial: What are Table Occurrences? with the same data source table.

              • 4. Re: Creating Record to Table from Another Record in the Same Table
                TiffanyMulally

                     Ok, so I think I set up the two table occurrences. Now, the problem is, I would like a place to list all acts of plagiarism (plagiarizing and being the source) that student is involved in. I tried putting a portal on the student info tables (either one) but they are not connected to the other student info table so that information does not show. 

                     ie.

                     I want to show all documents created with Brian Thomas' WIN number (student id). I put a portal on Student Info | Plag to documents and show only those where the Student Info::WIN=Documents::Source WIN and another tab to show the portal for when they are the plagiarizer StudentInfo::WIN=Documents::Plag WIN.

                     Any thoughts? I have attached my table relationship.

                • 5. Re: Creating Record to Table from Another Record in the Same Table
                  philmodjunk

                       But they are connected. They are connected by  Documents--though I don't recommend that you set up Documents as your join table. I would assume that the same document might be the source of more than one act of plagiarism so I would not set the documents table up as the Join table.

                       But using what you have for this example, you can set up a layout based on Student Info | Plagiarizers and add a portal to documents. To see data from Student Info | Source, you can add fields from Student Info | Source into the portal row of this portal.

                  • 6. Re: Creating Record to Table from Another Record in the Same Table
                    TiffanyMulally

                         Great. The changing of the fields worked. When I am on the plagiarist's record, the source tab is populated perfectly. Unfortunately, when I am on the source's record ( StudentInfo | Plagiarizers) neither tab is being populated- the plagiarism tab should be filled. The filter for the portal is StudentInfo | Plagiarizers:: WIN= Documents:: Source Win

                         Second question- what join table would you recommend?

                         Thanks!

                          

                    • 7. Re: Creating Record to Table from Another Record in the Same Table
                      philmodjunk

                           A many to many relationship is "one way". Defining a linking join table record that links the plagiarist to their source does not link the source the plagiarist, when viewing the data from the same layout. In some situations, this can be handled with a script that automatically creates a second join table record with the values in the ID fields swapped to create a second "link back" so that it is a two way relationship.

                           But in this case, that could create confusion as to whether the data listed in the portal lists sources or plagiarists. (You can't rule out the possibility, however small that a plagiarist could in turn be plagiarized.) I recommend setting up a layout based on Student Info|source for viewing the individuals that Plagiarized that source.

                           For a Join table, I recommend that you add a new table and link both occurrences of student info and also the documents table to it. That way, one record in the join table identifies the plagiarist, the source and the document plagiarized.