5 Replies Latest reply on Jun 16, 2015 3:27 PM by philmodjunk

    Displaying Roommates Information

    JoshuaGagnon

      Title

      Displaying Roommates Information

      Post

      Hello Again Forum!

      I am working on a student schedule printout that has their class information, room number, group assignments, as well as the name of their roommate (all of which is contained . I'd like to be able to display their roommates information (the school they are from [HighSchool], year of graduation [YOG], etc.) on their printout. Is there an easy way to accomplish this?

        • 1. Re: Displaying Roommates Information
          philmodjunk

          If you have one record in the table for each student and a primary key field that uniquely identifies each student, (Names are not unique), you can add a "roomateID" field to store the primary key value of a room mate. Then a self join relationship can access all the data found on the Roomate's student record.

          This assumes that all students never have more than one roommate. If multiple roommates are responsible, you need to set up a join table to facilitate what is now a many to many relationship.

          • 2. Re: Displaying Roommates Information
            JoshuaGagnon

            Thanks. To clarify I am working on our "Summer2015" Database. Each student already had a unique "databaseID" so I am able to grab information from our main "UBData" database (which houses personal/contact information among other things while the summer has classes, roommates, etc).

            Do I need to create another unique ID or can I somehow use the existing one to grab the roommates information?

            • 3. Re: Displaying Roommates Information
              philmodjunk

              As long as you have a field where the value uniquely identifies each student, you can use that one.

              • 4. Re: Displaying Roommates Information
                JoshuaGagnon

                Ok. Still a bit lost - sorry (and thanks).

                Student A (ID#01) is Rooming with Student B (ID#02).

                I'm creating a printout that lists all of student A's classes, etc (I had been using Merge fields to gather than info). What do I write/create. To get student B's info. listed on Student A's sheet (and visa versa)

                • 5. Re: Displaying Roommates Information
                  philmodjunk

                  Depends on the where that info is stored.

                  To start, if your table of student info is named "students", you'd set up this relationship:

                  Students::RoomateID = Students|Roommate::databaseID

                  "Students|Roommate" is just a name that I've specified for a second occurrence of the Students table in Manage | Database | Relationships. This allows you to put any fields from Students|Roommate on your Students layout to show information about the student's roommate. Note that you have to set the correct value in RoommateID of both records so that each student can see the other's data.

                  But if you want to list a class schedule and this is data from a related table as is most often the case, to list a class schedule for the roommate would require linking in a new Tutorial: What are Table Occurrences? of the class schedule table to the new Students|Roommate table occurrence.

                  For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations ExplainedCaulkins Consulting, Home of Adventures In FileMaking

                  PS. there's no real reason to use <<merge>> fields unless you need to "flow" the data from the fields into a typical narrative or paragraph format.