# How to implement scheduling

We are creating a simple app that can be used by an instructor to schedule classes with students. The use case is as follows. This instructor creates a class at a given time e.g Sat 1pm and chooses an option for the class to repeat every week for the next three weeks. When the instructor hits the create class button, we would like to create a total of 4 class records in the database.

Is it possible to implement this in adalo ? Making the instructor enter the same information 4 times is a deal breaker in terms of usability. We are not looking at complicated scheduling patterns (like a google calendar) - just something simple that makes the user experience better.

Any help/ideas appreciated,

Thanks,

Hi @authenticyogi, There are currently no loop functions available in Adalo to create some thing like βdo this x timesβ.
You can create it by using multiple Click Actions with a condition:

• Create record β¦, if Counter = 1
β Counter = Counter +1
• Create record β¦, if Counter = 2
β Counter = Counter +1
• Create record β¦, if Counter = 3
β Counter = Counter +1
• Create record β¦, if Counter = 4
β Counter = Counter +1

Not elegant, but doable. Depends on your use case, e.g. if you can restrict the number of iterations to a maximum.

Fo calculation with days and minutes, see: How to calculate with days and minutes

@karimoo Thanks ! Are there any examples of this strategy that you can point me to ?

@authenticyogi I created a small example you can clone from here: https://previewer.adalo.com/b1b343c8-830e-4b62-a310-ce38fa37baee

Creating a Counter
As we do not have the option to use variables to keep and updated the counter value, I am using a collection to manage the counter:

Overall Flow
The overall flow looks like this:
The user enters start date and time, Title of the class, and number of repeating sessions (max 5 in this example).

1. Create Counter

2. Create Class Schedule

First we create the last session.

3. Update Counter

We subtract 1 from the number of sessions.
Note that after we create the counter value in the first step, we can now reference the new record with New Counter.

4. Repeat steps 2 and 3
The maximum number of sessions we can create with one click depends on the number of repeating steps.

5. Delete Counter

To have multiple users working at the same time you would need to have the counter in the User collection, which I skipped for this demo example.

As I said before, it is not a very elegant solution to simulate a loop.
Tomorrow August 4th, the new component marketplace will launch with a calendar component.
It is probably a good alternative to use the calendar component and let the user click on a date to create the schedule.

2 Likes

Brilliant stuff Christof! Nice implementation too!

There is also a request for this as a feature which can be found here: https://ideas.adalo.com/feature-requests/p/recurring-events