Creating a schedule based on days of the week and number of lessons

843 1
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

I am a long time user of AT. However, I need some assistance.

I do operations for a school. I need an elegant way to create the schedule automatically for the classes.

I want to input the date of the first class, the days and times they have the classes every week, and the number of lessons in each learning period.

I want to automate it, so at the click of a button all the lesson records are created based on the conditions listed above. Is it possible?

1 Reply 1
6 - Interface Innovator
6 - Interface Innovator

Hi Finlay,

I did something similar in the past, copying classes + linked students from an existing one and according to some parameters that the user should introduce: start-end of the classes period (Sep 1st to Jun 30), recurrent days (7, 14…), include or not the students and teachers

The complexity of the situation cannot be handled by a simple automation. This is what I did:

  • Created a button field in the classes table
  • I linked a code block to the button press event
  • The code block got the record that fired the event and extracted the basic data: Location, time, duration, day of the week and the students in that class (linked record ids)
  • In the code block the user could enter the parameters for the copy: starting and ending date for the block of classes, the periodicity, and if they wanted to include the same teacher or not (teachers are in a linked table)

These selection of data can be added to the code block in different ways, it’s not straightforward but doable. You can experiment with the input functions as (await) input.buttonsAsync, input.textAsync, input.tableAsync, etc. The API documentation is good enough.

Once the user validated the parameters, the code worked as

  • Loop over the new dates of the class using the period as incremental index
  • Create a new class for the new date using the original class parameters (time, location…)

It took me a while to set everything up, but in the end it worked fine and saved a lot of time to my users.

If you would like more detail, let me know and I can prepare a deeper explanation.
I hope this helps, good luck