Creating Multiple Records, skipping days

Discussion created by jbrown Expert on Oct 21, 2012
Latest reply on Oct 22, 2012 by jbrown

Hi all,

I've got a function that needs to happen:

Teachers are able to assign after school "Office Hours" to students for various reasons. They want to be able to go to that student's record and pick days of the week on which to assign the office hours. They could choose any week day. They also need to pick how many days they want office hours and the start date.


I've got a layout that shows the days of the week as Checkbox Booleans, one for each day. The layout also contains the number of days and the start date fields.


What i need to be able to do is create records in the Office Hours table for those days only that they chose, starting on the day they chose, and for the number of days they chose.


I actually did this in the past, but the script was long and cumbersome. I feel like there's a better way.


What I'm thinking is i loop through the part of the script that creates the records for the number of days that they chose in the global field described above.


The issue that I have is with the date field being set to the right date, depending on the booleans that were checked off on the layout. For example, if i chose to M and W for 5 days, I should get records with the date of 10/22, 10/24, 10/29, 10/31, and 11/5. How do I do this in an efficent manner?