7 Replies Latest reply on May 14, 2013 9:20 AM by philmodjunk

    Auto Fill Portal

    compassmatt

      Title

      Auto Fill Portal

      Post

           Hello, I am new to filemaker and I am trying to make a gradebook database. When I create a new assignment I need a portal to populate a row for each of the students, with the student's name as the first field on the portal row. i have the student database with the names already created. How do I go about having the assignment database auto pop the all the student names whenever a new assignment is created?

        • 1. Re: Auto Fill Portal
          philmodjunk

               Write a script that loops through your student records, creating one related record for each student record. The details of that will depend on the relationship you have created for the portal.

          • 2. Re: Auto Fill Portal
            compassmatt

                 Writting a loop is what I need help with. I have no idea how that would be accomplished. I have one DB that has all the student info, and one DB that is the grade book (it has two tables - the Assigment table and the grade table). The portal is in the assignment and is linking to the grade table. When I create a assignment i need the portal to create records in grades table with the student names populated.

            • 3. Re: Auto Fill Portal
              philmodjunk

                   Sounds like you need these relationships:

                   Assignments------<Grades>------Students

                   Assignments::__pkAssignmentID = Grades::_fkAssignmentID
                   Students::__pkStudentID = Grades::_fkStudentID

                   And this would NOT place a student name in the Grades records. Student names are not unique and might change on you. (Even grade school aged children undergo legal name changes such as a step parent adoption.) But you will be able to show the student name in this portal by adding the student name field(s) from Students to the portal row.

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

                   That would enable a looping script like this to assign a given assignment to all records in the Students table:

                   #Perform script from an Assignments layout
                   Freeze WIndow
                   Set Variable [$SAssignID ; value: Assignments::__pkAssignmentID ]
                   Go to Layout ["Students" (Students) ]
                   Show All Records--->this will need to be changed if you only want to assign some students instead of all students
                   Go to Record/Request/Page [First]
                   Loop
                      Set Variable [$StudentID ; value: Students::__pkStudentID]
                      Go to Layout ["Assignments" (Assignments)]
                      New Record/Request
                      Set Field [Assignments::_fkAssignID ; $AssignID]
                      Set Field [Assignments::_fkStudentID ; $StudentID]
                      Go to Layout ["Students" (Students)]
                      Go to Record/Request/Page [Next ; Exit after last ]
                   End Loop
                   Go to Layout [original layout]

              • 4. Re: Auto Fill Portal
                compassmatt

                     Good idea on basing info on StudentID and not name, I hadn't thought of that. I will give this a try 

                • 5. Re: Auto Fill Portal
                  compassmatt

                       Well, It works for the first two records, and then it loops on the 2nd record until i escape the loop. Im not sure why that is but thank you for the help getting me this far!

                  • 6. Re: Auto Fill Portal
                    compassmatt

                         OK, I found my error. I am wanting to only have records created for "Active" students. Once I added Show All Records it worked just fine. I just need to work out the only "Active" Students portion.

                          

                          

                    • 7. Re: Auto Fill Portal
                      philmodjunk

                           In place of Show All Records, perform a find for only the student records that you want.