Results 1 to 9 of 9

Thread: [RESOLVED] Need Ideas. Transactions/Temporary Tables? I have no idea

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Resolved [RESOLVED] Need Ideas. Transactions/Temporary Tables? I have no idea

    Hi Guys,

    I have a school database with an attendance register. At the moment, the teacher selects his class and I load a grid with the students names in column 1 and each day of the current week in the following columns. The day of week columns have a checkbox where the Teacher can mark the student absent for that day. This works well.

    However, the teachers say it would be easier to mark all students absent for the day and they would then untick the students that are at school. My questioin is, how do I best solve this problem. I could write absent records to my table for the current day when the teacher selects a class but that would make my table extremely huge.

    Please advise me on the best way to accomplish this task. Thanks

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    However, the teachers say it would be easier to mark all students absent for the day and they would then untick the students that are at school
    Why not implement a check all functionality (Ex. add checkbox in column header). So, if this column will be ticked, the checkbox will be ticked/unticked.

    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    Hi. Thanks for the suggestion. They want all students marked absent for the day automatically. As they tick each record the student is marked as present. I'm wondering how to implement this. At which point do I make the table entries etc?

  4. #4
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    They want all students marked absent for the day automatically. As they tick each record the student is marked as present.
    You can initialize the column values to be empty for a given day. Or load null/empty values during the start of day. So, once the datagridview
    shows the column for that day, the default checkbox values are unmarked.

    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  5. #5
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    I'm sorry, I'm not sure I understand what the problem is. You've said you've already got a working solution where the grid comes up with unchecked boxes and the teacher ticks them to indicate absence. To turn that on it's head all you've got to do set the defaulte state of the checkboxes to checked instead of unchecked. That should be very easy.

    As for when you should do the data updates, well you should do them in exactly the same way you are already. Ultimately you're just saving a record to the database and recording whether the box was checked or unchecked. That doesn't change at all.

    Is there something I'm not understanding?
    Last edited by FunkyDexter; Dec 9th, 2013 at 08:29 AM.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  6. #6

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    Hi FunkyDexter,

    I understand what you mean. however, say for example I have Student A and Student B. If I load the grid with the default state of unchecked for both students for today they are not actually marked as absent for the day in the database. If I untick Student A he is now present for the day. However, since I haven't clicked on Student B he shows as absent on the grid but he isn't actually absent.

    This is my problem. At which point do I insert absent records into my table? If I have a class of 50 those are 50 more entries into the database that I currently have which is going to cause the table to grow very quickly.

  7. #7
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    You should insert the records when the teacher finish to uncheck the present students
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  8. #8
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    Ah, I think I see. You don't have a "present" record but rather an "absent" one and don't have a natural trigger point to create it if they're absent by default, is tat correct? I'm guessing you used to create the absence record when the teacher ticked the checkbox, correct?

    Assuming I'm correct I can see a couple of options:-
    1. Change your design so that you store presence rather than absence records. Or even better store a record for EVERY student with a boolean value to indicate whether they were present or absent. This would probably be a big change to your database though so might not be the easiest solution.
    2. When loading up the grid create absence records for all the students. I assume you used to delete the absence record if a teacher unchecked a box (or they couldn't recover from an accidental click) so this should then allow your app to just keep working as is.
    3. Don't save changes when the teacher checks or unchecks a box. Instead give them a "Save" or "Commit" button that persists all the checkbox states back to the database in one go.

    I think I'd proabbly go for option 3 myself but it depends largely on the exact experience you want to offer.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  9. #9

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Need Ideas. Transactions/Temporary Tables? I have no idea

    Thanks again FunkyDexter. You are spot on. I'm going for option 2 as they prefer a save on each click.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width