Skipping Weekends and School Holidays

Discussion created by jbrown Expert on Apr 26, 2012
Latest reply on Jul 31, 2015 by greatgrey

I apologize if I ask too many questions. I hope there's no required ratio of questions to contributions on this board.


My school uses our database, called the KIS (KIPPster Information System) to enter behavior consequences, aka detention. The administrators sometimes assign a kid multiple days of detention after school. I have a script that simply takes the number of instances they want the kid to be on (how many days) and creates a record in the behavior table that number of times, looping until the looped variable reaches the number of days the admin puts in.

IF an adminstrator chooses 5 days, it will loop through 5 times, writing a record on each loop. This script skips Saturday and Sunday but checking to see if the DayName() of the newly-created record is a saturday and then re sets the date adding 2 days. It skips sunday by adding 1 day to the date. I feel this is clumsy, but i know of no other way.


One of the problems is dealing with holidays, no school days. How do I get the database to skip those days? I assume a 'no school days' table is involved, but i'm not sure Is there a relationship involved as well? How do i get the script to look at the day it just created and check to see if it is a no-school day, and reset the field as the next day?


Is it a matter of looking up the date just set in the Detention::Date field to see if it matches a no school day?


Can the same thing be done for the weekends, or is my method okay?