I have tasks that need to be scheduled to run on specific days of the week. Each day a task is scheduled to run, an assignment for that task needs to be created. I have a field that the user selects the schedule frequency (daily, weekly, Quarterly, etc...) The one I am having the most trouble with is the daily. When the frequency of daily is selected, a second field displays called dailyFrequency that allows them to enter check boxes S M T W T F S, which are numbered 1, 2 3, etc respectively. If they check boxes 2,3,4,5, 7 each week, I'm having trouble developing a strategy to determine the next due date for that task. I have 3 variables.
1. A variable called $days that lists the days of the week the user has selected like this: SortValues ( Task Group::dailyFrequency; 2; "English").
2. A variable called $today that is just get (currentdate).
3.A variable that determines the day of the week for today's date DayOfWeek ( $today )
If today is Sunday (day 7), the next value I want in that list is the 2 so that I can determine the next upcoming date based on the next day. I'm stuck like chuck. I keep thinking of extremely complicated calculations that take me in circles. Maybe I'm thinking about it all wrong. Any help is much appreciated!