0

Attendance record

This my setup. I have

1. Table Students1 (all students) and

2. Table Classes with:

- 'Linked from' table Students2 (subset of Students1 that belong to a class)

- Sub-table Sessions (with date and topic)

Is it possible to retrieve Students2 automatically within sub-table Sessions and add a field with attendance information for each student (forexample, a yes/no field)? It is possible to retrieve such info using a 'view' table but then you cannot add any information

.

13 replies

null
    • Birger_H
    • 6 yrs ago
    • Reported - view

    This can be done with Ninox. 

    Birger

    • Mconneen
    • 6 yrs ago
    • Reported - view

    I am not quite there yet..   First hack is as follows... the defect is that when taking attendance.. it shows ALL students. 

    Model 1

    Second hack..  Have the Attendance subtable reference the class roster. 
    Model 2

    The drawback here.. When taking attendance within a session .. when looking up against the Roster.. it shows the roster for ALL Classes.. (hence your earlier comment about using a view to filter to just the desired Class Roster)..  

    So while the end result is what we want. the taking of Attendance is not..  I can easily do this in FileMaker / Access via association / joins.. but am struggling with the "subtables" ..  :( 

    Session Attendance

    • Mconneen
    • 6 yrs ago
    • Reported - view

    OK.. this will take me a bit to test.... When creating a Class Session row... Have a create trigger that creates the Attendance subtable for that Session by select / inserting from the Class Roster.. :)   I think that will work..  If the class roster changes between Sessions.. No worries.. 

    hack3

    • Mconneen
    • 6 yrs ago
    • Reported - view

    I am SOOOOO close..   I tried this code in a Trigger on create in the Session table.. 

    let s := this;
    for p in select Roster where Class = s.Class do
       let a := (create Attendance);
       a.(Session := s);
       a.(Student := p.Student);
       a.(Presence := true)
    end

    But it did NOT work.. So I put that exact same code in a Button field on the Session record.. and POOF.. it works.   Now I am puzzled as to why it does not work on create.. :( 

    Session Attendance

    • Mconneen
    • 6 yrs ago
    • Reported - view

    OK.. This just struck me..  Evidently the code does NOT work on the Trigger on Create .. because when the row is "created" .. the association to the Session.Class does not yet exist....   So Ninox must create the Session row first.. THEN let me add the associated Class..  MOVING the code to the Trigger After Update on the Session.Class attribute did the trick.. Hmm.. 

    Session Attendance

    • preboredo
    • 6 yrs ago
    • Reported - view

    Thanks for all the food for thought. 

    • preboredo
    • 6 yrs ago
    • Reported - view

    I’ll put your solution to use as soon as possible. One question: Is the ‘student 1’ within the ‘session’ subtable related to the ‘student 1’ in ‘Student’? Or ist it just a copy of the name of the student in an unrelated record?

    • Mconneen
    • 6 yrs ago
    • Reported - view

    Here are the table defintions.. 

    Student -> list of all students within the organization. 

    Class --> list of all classess offered by the organization. 

    Class.Roster --> List of Students registered for a specific course.   There are relationships back to Student and Class. (I guess Course would have been a better name for the table)..

    Class.Session -->  There is one instance for each time the class is in Session.  There is an after update trigger on the Class reference that creates  Class.Session.Attendance record for each Student that is on the Class.Roster... 

    let s := this;
    for p in select Roster where Class = s.Class do
       let a := (create Attendance);
       a.(Session := s);
       a.(Student := p.Student);
       a.(Presence := true)
    end

    Class.Session.Attendance --> There is one row per student on the Class.Roster... per Class.Session ..   AKA.. Your attendnace record. 

    I do not see a way to upload files to this forum..  You can grab the sample from here. 
    http://mconneen.infointegrators.net/ninox/Class%20Attendance.ninox

    Here is a summary snapshot.. Hope this helps. 

    The Model

    • preboredo
    • 6 yrs ago
    • Reported - view

    It works exactley as I wanted, many many thanks. And it does give me an attendance record for each student. 

    • Mconneen
    • 6 yrs ago
    • Reported - view

    My pleassure preboredo ..  I enjoyed learning a bit more about Ninox.. and it is easier to learn when having a use case...  You can certainly extend the solution by creating a function to name the session .. I assume they are date / day oriented..   For example, I used to lecture on the Java programming language weekly at DePaul Univeristy on Tuesday evenings between 6 PM - 9 PM.. etc.. ;)

    Happy Ninox-ing.. :) 

    • Jaime_Blanco_Landau
    • 4 yrs ago
    • Reported - view

    Hi Mconneen,

    I used your approach and that worked.

     

    The only was that after I create a session and then I update the Roster, the attendance list don't get updated (as showed in the image)

     

    Any clue on this?

    Thanks

    • Mconneen
    • 4 yrs ago
    • Reported - view

    @ninox.admin, 

    WOW.. I had to go back an reread the thread.. this was a while ago.. 

    Yes.... the session trigger after update adds the students from the roster to the association table.  If you then change the roster.. You are correct.. Prior sessions will not reflect that student as they were not on the roster at that time.  So if session 1 is on Tuesday .. and Student B is added to the roster on Wednesday .. they will not be shown as absent on Tuesday .. as they were not officially enrolled ...   If that is important to you.. then you will have to add logic into the Roster such that when you ADD a student.. you go back and show them as absent for prior sessions. 

    • Jaime_Blanco_Landau
    • 4 yrs ago
    • Reported - view

    Hi Mconneen,

    What I did was to put a button on each session form and "on click" used this:

    let s := this;
    for p in select 'Roster' where Class = s.Class do
    let a := 'Attendance';
    delete a
    end;
    let s := this;
    for p in select Roster where Class = s.Class do
       let a := (create Attendance);
       a.(Session := s);
       a.(Student := p.Student);
       a.(Presence := true)
    end

    I click on the button to update the Attendance list before each Session occurs. With this if there is any new student registered in Roster, the attendace list gets updated. 

    But whith my code I delete the attendance list and then recover it from the Roster. That is not good since it also delete the "Presence".

    Any idea on how to update the attendance list without deleting it before.

    Thanks.

Content aside

  • 4 yrs agoLast active
  • 13Replies
  • 5126Views