Detail subject: Populating identification data from other tables for Grid Add/Edit but don't save these data into the Grid Add table when inserting/updating Grid Add/View
Dear All,
I am developing a small app for students’ attendance but I am facing a problem.
I have the following tables with the following main fields
- Schools – fields: school_code, school_name,..etc
- Students – student_id, std_name, std_grade, std_age, school_code
- Attendance_master
- Attendance_details
The table ‘attendance_master’ has the following fields
Attendance_id – primary key
School_code – foreign key [primary key in table schools]
Month_of_attendance
academic_year
The tabble ‘attendance_details’ has the following fields
Attendance_id – foreign key [primary key in table ‘attendance_master’]
Student_id – fk [Primary key in table ‘students’]
days_present – integer /* total number of school days student is present /
days_absent - integer / total number of school days student is absent */
To fill out attendance of month e.g. January for 100 students in school X, I would like to do the following
a. I have attendance data of the students in a hard copy format and copying from there to the database (Mysql)
b. To avoid redundancy, I first fill out table ‘attendance_master’ with the above mentioned fields and then use the ‘attendance_id’ to update the ‘attendance_details’ records for that school and for the month of January (Master/Detials)
c. To accomplish point (b), I need to use ‘Grid Add’ to update the ‘attendance_details’. I want the details of the 100 students in school X especially (scode, std_id, std_name, std_grade) to be pre-populated in the Grid Add and I want them to appear as labels on the Grid so that the person performing the data entry knows for which student is s/he filling for (based on the hard copy attendance) and the fields days_present and days_absent to be as text and ready for user input.
The data that I need to be updated in table ‘attendance_details’ are
Attendance_id ,
student_id,
days_present,
days_absent
but not the following fields
scode,
std_name,
std_grade
because I can use the ‘attendance_id, student_id to fetch the other relevant data using Mysql join queries but t
The issue is that table ‘attendance_details’ does not have the fields that I want to show in the Grid Add i.e. (scode, std_id, std_name, std_grade). I am avoiding to put these fields into the table ‘attendance_details’ as it creates redundancy.
My question is how can I accomplish point (c) and is there a better way to do it?
Looking forward to your help
Thanks in advance,
PS: I am using Mysql and PhpMaker 12
Regards,
Omar