4 Replies Latest reply on Oct 13, 2009 9:31 AM by philmodjunk

    Scheduling that repeats 3 times a week...can this be done?

    bwbono

      Title

      Scheduling that repeats 3 times a week...can this be done?

      Post

      I am hoping to find a way to automate some of my scheduling. Like I need to schedule a class every Monday, Wednesday and Friday from 9:00am to 10:45 am for the entire year. Maybe even have the location vary and also to have this script avoid any holidays or other dates I decide on.  I have the concept in mind, but I a just am lost trying to figure how to make it happen.

       

      Thanks for any help or ideas

      Bruce 

        • 1. Re: Scheduling that repeats 3 times a week...can this be done?
          philmodjunk
            

          Here's a couple of general hints:

           

          You can use one table to schedule each appointment and a second table where each record represents one day to record holidays.

           

          Add seven to any date field and you'll get a date one week in the future.

           

          You set up a pair of loops. The outer loop will create apppointments for one year's worth of appointments for a given day of the week. Each time you repeat the loop, you'll set it up for the next day. In your example, the first time around give's you a year's worth of Mondays, the second time around set's up the Wednesday dates and the third, you Friday dates.

           

          You inner loop will add 7 each time around and check the date against the holiday dates to see if an appointment is scheduled. Exit the loop when you've created a year's worth of appointments for the selected day of the week.

          • 2. Re: Scheduling that repeats 3 times a week...can this be done?
            bwbono
               Thanks again, Phil. Your clear thinking helps a lot. Logical. I will work on it and let you know how it goes. Thanks again for your time and skills that you share. Really an excellent thing you are all doing here. As I scratch the surfaces of File Maker and hack away, I am completely humbled by you guys here.
            • 3. Re: Scheduling that repeats 3 times a week...can this be done?
              bwbono
                

              Thanks, PhilMJ

               

              I was able to build the easier loop...the "inner" one.

               

              But I am stumped on the outer loop. I cannot figure how to set up a way to choose the day of the week and then step to the next one.

              I had thought using a  checkbox to choose any number of days, but I cannot figure how to then use it for the loop. Should I set this up differently to use it in this outer loop?

               

              I also have the table of "holidays" built, but I have not thought on this end...still trying the outer loop, but stuck again.

               

              I have a value list of the days of the week as a checkbox set inside a field called weekdays. I was hoping to use this as the input for the looping/expanding. I would imagine there are much better ways to accomplish this, too. Best I could come up with, scratching away as I seem to do.

              Thanks again for your help. This huge database solution I am building is now in use ( as of 3 weeks ago ) in Vienna, Austria at an acting school. It is meant as a complete solution and it is actually working! You have helped me solve quite a few problems and I thank you again. 

              • 4. Re: Scheduling that repeats 3 times a week...can this be done?
                philmodjunk
                  

                Actually a checkbox field of daynames can work and is a fairly user friendly way to set it up. First, you have to understand how checkbox fields store data. Each selected value is stored in the order the boxes were clicked separated by carriage returns. You can observe this, if you place an unformatted (edit box) copy of your check box field next to it and watch how the contents change when you click different check boxes. (Make sure the edit box copy is tall enough to show all selected values.)

                 

                Thus, LeftWords(CheckBoxField; 1) will return the first day name clicked in your checkbox field.

                 

                I'd set up a variable to store this list of values and delete the left word each time around the loop and exiting the loop once the variable is empty.

                 

                Set Variable [$Days; Value: YourTable::YourCheckBoxField]

                Loads the variable at the start of the loop.

                 

                Set Variable [$Days; Value: RightWords($Days; WordCount($Days) - 1)]

                Strips off the leftmost word after you have processed it.

                 

                Case (Leftwords ($Days; 1) = "Sunday"; 1; Leftwords ($Days; 1) = "Monday"; 2  /* do this for each day name in your value list */)

                Will turn your list of day names into numbers you can use to compute dates

                 

                If you only create date records in your holiday table for those days that are holidays, you can create a relationship that links the two tables by matching date fields. Then, the function, IsEmpty(HolidaysTable:: DateField) will be true only if the date in your current record is NOT a holiday.