4 Replies Latest reply on Dec 20, 2012 10:38 PM by DaveMartyn

    Newbie question re setting up relationships

    DaveMartyn

      Title

      Newbie question re setting up relationships

      Post

           I'm sure there is an easy way to do this, but after hours of combing through tutorials and posts, I'm still stuck.

           I have a database of student info from a number of schools. I often use scripts to filter and display students from only one school. Easy.

           Now I am modifying my solution so that it can be used districtwide. So I need a way for each teacher to enter their schools  and then perform finds in the same way. So I guess I set up a table defining their schools (School #1=Washington, and so on), and then link it somehow so when teacher A performs a fine request for her "school #1" it matches records from Washington school, and when teacher B selects his "school #1" it shows students from Lincoln School. And so on.

           I'd much appreciate a quick step-by-step.

           Thank you!

        • 1. Re: Newbie question re setting up relationships
          philmodjunk

               If teachers only ever have one school to specify:

               Schools------<Teachers

               Schools::__pkSchoolID = Teachers::_fkSchoolID

               If teachers, such as a Band teacher, can teach at multiple schools, you have a many to many relationship:

               Schools-----<Teacher_School>-------Teachers

               Schools::__pkSchoolID = Teacher_School::_fkSchoolID
               Teachers::__TeacherID = Teacher_School::_fkTeacherID

               If tihs notation is unfamiliar: Common Forum Relationship and Field Notations Explained

               With this last setup, you typically place a portal to Teacher_School on a layout based on one of the other two tables to list either the schools at which a teacher teaches or the teachers that teach at a given school

          • 2. Re: Newbie question re setting up relationships
            DaveMartyn

                 Thank you very much Phil- This is very helpful. I am working through the steps.

                 In this case, it is the second example, where one band teacher teaches at multiple schools. But the database will be installed on each teacher's laptop, so do I need to include a table with the list of all teacher names? Can't they just enter their name in one field?

                 Finally, how would I construct the find request? 

                 Thanks for your help.

            • 3. Re: Newbie question re setting up relationships
              philmodjunk

                   There is not enough info about what you are trying to do for me to answer your questions with any real confidence that I am giving you good advice..

                   Will each teacher only record data about themselves and their teaching assignments?

                   If so, you have a one (teacher) to many (schools) relationship and you can use:

                   Teachers-----<Schools

                   Teachers::__pkTeacherID = Schools::_fkTeacherID

              • 4. Re: Newbie question re setting up relationships
                DaveMartyn

                     Yes, that is correct. I'll work with that. Thank you!