12 Replies Latest reply on Jan 25, 2012 9:38 AM by philmodjunk

    Another attendance register question

    tomo17

      Title

      Another attendance register question

      Post

      I have been reading through the threads related to this topic and have hit a road block when creating an attendance register. I am able to pull up a classlist but cannot work out how i add/select the date that i wish to take the attendance for.

      I have set up the tables and relationships as follows based on what i have read through the threads:

      Student Info::StudentID=Enrolment::StudentID

      Enrolment::CLassID=Classes::ClassID

      AND

      Student Info::StudentID=Attendance::StudentID

      Attendance::ClassID=ClassList::ClassID

       

      When i goto a layout based on the classes table with an enrolment portal i am able to populate the claslist but cannot work out how i add the date for the current class (preferably for all students in the class) and then repeat for the same class later in the week without overriding the initial entry.

       

      Thanks for any advice or pointing me in the direction where this has been discussed.

        • 1. Re: Another attendance register question
          philmodjunk

          What version of FileMaker to you have?

          Have you created scripts before?

          You'd need a script that generates a set of attendance records for each class session and a filtering mechanism (either on your found set of attendance records or a filtered portal to that table) to control which set of such records are visible. There are several possible options for that.

          Or you can set up an interface where clicking a button creates an attendance record when you mark a student as "present". In this approach, absent students do not have an attendance record for that date.

          Either approach takes scripting to make it happen.

          You might also consider setting up a table of class meeting dates from your school calendar as a way to automate the process of assigning the correct date for a newly created attendance record--something that can help with either option. (A table of meeting dates can make it easy to adjust for holiday closures, unusual meeting dates, etc.)

          • 2. Re: Another attendance register question
            tomo17

            Thanks Phil for your reply.

            I am currently using FMP 11 and i have used and understand the scripts before with some help from this forum for the more complex ones.

            My initial intention was for the user to choose the date that they wished to enter for using a calendar (this would generate the date field) and then for the user to change a default participant status as required.

            From a reporting perspective i am really only after two pieces of information.  I feel comfortable that i can work my way around these at this point:

            - an absentee report for a particular day that can be chosen by the user

            - a class/individual summary report that lists the number of days present, absent, late etc (a third one would possibly be that i can click on a button that would take me to that particular individuals attendance summary ie date, attendance status in a seperate report)

            I am not sure if i understand the schedule suggestion.  

            - Would this require me to enter every day of the school term or just the day and period the lesson is taught ie Monday period 3.

            - What is the benefit of doing such a thing as it appears that i would possibly have to enter 200 dates into this table?

             

            Many thanks again for any help

             

            Craig

            • 3. Re: Another attendance register question
              philmodjunk

              Student Info::StudentID=Enrolment::StudentID

              Enrolment::CLassID=Classes::ClassID

              AND

              Student Info::StudentID=Attendance::StudentID

              Attendance::ClassID=ClassList::ClassID

              If you have the user enter/select the date then click a button to set up the attendance records for a specified class session, you do not need a "school calendar" file, though such a file does not require manually entering every date of the school year. You either enter just the meeting dates or you enter the first and last days of the school year and use a script to generate a record for evry day in the date range thus specified. (The second approach opens the door for a calendar feature where you manage more than just class sessions.)

              Here's a script that will take a date entered into a global date field on a layout based on the class table and then generates a set of attendance records for that class and date from the enrollment records for that class:

              #Must be performed from layout based on Classes
              Freeze Window
              Set Variable [$ClassID ; value: Classes::ClassID
              IF [ Enrolment::ClassID // check to see that enrollment records for this class exist, ClassID should be type number for this test ]
                 #Create found set of enrollment records for this class
                 Go To Related Record [Show only related records; From table: Enrolment ; Using layout: "Enrolment " (Enrolment )]
                 Go to record/request/page [first]
                 Loop
                     Set Variable [$StudentID ; value: Enrolment::StudentID ]
                     Go To layout [Attendance ( attendance ) ]
                     New Record/Request
                     Set Field [Attendance::StudentID ; $StudentID ]
                     Set Field [Attendance::ClassID ; $ClassID ]
                     Set Field [Attendance::MeetingDate ; Classes::gGlobalMeetingDateField ]
                     Go To layout [Enrolment ( Enrolment ) ]
                     Go To Record/Request/Page [next ; exit after last]
                 End Loop
                 Go to layout [ orginal layout ]
              Else
                  Show custom Dialog ["Error, no Enrollment records exist for this class." ]
              End If

              This script returns you on the Classes layout where a portal to attendance, filtered by gGlobalMeetingDateField can be used to record attendance. With a few small changes, the script could instead leave you on a list view of an attendance layout with only the newly created attendance records in the found set. Either approach leaves you with a list of students enrolled in the current class with the records marked with the meeting date selected by the user so that you can mark students present with a single mouse click on their attendance record.

              • 4. Re: Another attendance register question
                tomo17

                Thanks Phil

                I will have a go at this suggestion and see how it goes - i am sure any error will be on my side :)

                 

                Craig

                • 5. Re: Another attendance register question
                  tomo17

                  Hi Phil

                  I have tried you solution and keep getting a "no enrolmens found error" as per the script.

                  Could you clarify this section?  Am i to put something after the //?

                  IF [ Enrolment::ClassID // check to see that enrollment records for this class exist, ClassID should be type number for this test ]


                  I have included the database structure if this may be of help.

                   

                  Thanks

                  • 6. Re: Another attendance register question
                    philmodjunk

                    When you open manage | database | fields and check, what field type is Enrolment::ClassID?

                    If it is text instead of number, you may need to use:

                    Not IsEmpty ( Enrolment::ClassID )

                    • 7. Re: Another attendance register question
                      tomo17

                      Class::ID is a number already.

                      I am running the script from a layout that is based on classes where the user selects the classID, the date and then triggers the script using a button.  Doing this takes me to another layout that is also based on classes with a portal to attendance information.  at this point i now get all of the records for one of the students within that class ie John blogss 11/12/12 present, John Bloggs 12/12/12 absent, etc

                      Something funky is happening and i cant back track where it is happening...

                      • 8. Re: Another attendance register question
                        philmodjunk

                        I'm not asking about Class::ID, I'm asking about Enrolment::ClassID. It should be of type number in order for the original If step to work.

                        If you have FileMaker Advanced, run the script again with the script debugger and data viewer enabled and walk through the script one step at a time looking to see where things go wrong.

                        at this point i now get all of the records for one of the students within that class ie John blogss 11/12/12 present, John Bloggs 12/12/12 absent, etc

                        before you were getting the message that no enrollment records existed. What changed?

                        I think you need to post the script you have as it sounds different from what I have posted.

                        To post a script to the forum:

                        1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
                        2. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
                        3. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
                        4. If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
                        • 9. Re: Another attendance register question
                          tomo17

                          Sorry - typo error.  Enrolment::ClassID is a number.  

                          The changes that you ask of were as a result of me changing the IF statement to see if this would make a difference and i had neglected to revert back to the original script as you supplied - it now once again comes up with the error message.  I have attached a screen shot of the script as requested.

                          • 10. Re: Another attendance register question
                            philmodjunk

                            If the only change was to use Not IsEmpty (Enrolment::Class ID ),

                            Then Enrolment::Class ID is not of type number. Open manage | Database | Fields and check the type there. If it's a number field,

                            If [Enrolment::Class ID]

                            and

                            If [Not IsEmpty ( Enrolment::Class ID ) ]

                            will produce identical results. Only if Class ID is of type text might you get different results.

                            Unless you ran the script from a different layout not based on Class...

                            Is the layout named "Attendance Record" the current layout when you perform this script?

                            • 11. Re: Another attendance register question
                              tomo17

                              The enrolment::ClassID is a number, indexed.

                              The layout that the script is run from is based on the class table (although i have tried the script from the the attendance record layout as well).  It runs in find mode and has the field for class::classID and the class::gDate field.  i then use a button to trigger the script.  

                              I have tried the goto layout as original layout and as well as "attendance record" (Class).  

                              For each of these alterations i get the same error as the result.

                              I am tempted to try and build the db again but i am likely to end up at the same point trying to generate the record to take attendance!

                               

                              Craig

                              • 12. Re: Another attendance register question
                                philmodjunk

                                The layout from which this script is run must be based on the class table occurrence. That means that "class" should be the text you see in Show Records From in layout setup...

                                The enrolment::ClassID is a number, indexed.

                                In which case, the two different tests for the existance of related enrollment records: If [Enroment::ClassID] and If [Not IsEmpty (Enrolment::ClassID)] will produce identical results if run from the same layout with the same class record specified as the current record. They have to, so the only explanation I can find is that either you ran the script from a different current record or from a different layout to get the "no related records" message with one version and not with the other.

                                Keep in mind that the script assumes that the current record in Class is the class for which you want to generate attendance records. If there is no current record (say the found set is zero records), you'll get the error message as the script won't find any related enolmnet records in that case.

                                If you have FileMaker Advanced, I suggest enabling the script debugger and data viewer, then running this script from the class layout--stepping through the script one step at a time while monitoring field values to see where and why it is failing for you. If you do not have advanced, you may want to try inserting some show custom dialog steps that display the contents of selected fields at different points in your script so that you can check and see where it is going wrong for you.