Number of Mondays + next Monday

Hi, i’m building a app for a tennis training company, and need help. I have a table to save the classes, for example from today till the end of the year, every monday at 20:00 and i need to calculate how many monday between the 2 dates, and then register one event for each monday, on the events table with the data from the class. any ideas?

I think what you’re trying to do add these new rows automatically?

Hello, yes 2 problems, Yes, two problems:

  1. Automatically triggering rows, meaning I create one row and automatically add, for example, 10 rows in another table.
  2. Determining the next 10 Mondays from a given date.

Your idea is definitely possible, but I think the method to go about it needs to be revised.

The short answer is probably a JavaScript column to calculate the Monday dates, and then a scheduled workflow to add those rows. But I don’t think this is what you’re really looking for.

Could you explain to us the overall goal of the app? Why do events need to be added for only the next 2 Mondays?

A better way would be to probably have a full list of all Mondays in a year, and then set visibility based on if they are within the next two weeks.

alright in order to make this dynamic that is adding rows you’ll need to use the glide API. Depending on the number of Mondays we’ll have in a period you’ll have to add that number of rows.

Also,atom idea might be good to try out

So I assume you need to add all those dates right when an event is added through a form or something like that?

What if a person cancels the parent event? Do you allow that to happen?

Do we allow adjusting the child events?

The overall goal of the app is to manage tennis training lessons. I have two tables, one is where i define the tennis classes, in which club house, in what court will be, that can have up to 8 students and happen every Monday (for example) from date1 to date2. The second table is where i manage the training events, where i register for each training lesson, who was present, what have been done, so I need 1 line for each lesson in a separated table.

I understand that ideia, i was developing in the free version to understand if it was possible and dont have API available.

Yes, if a class is canceled, i will have to update the future events for that class, with a deleted status.

I think revisiting this idea might be your best option:

This also allows for one master calendar table to be used where each Monday can pull in the availability from one table, the tennis classes table, and the training events table, as to not double book.

Still confused if the Tennis Classes are the parent to the Training Classes?

So I assume a class would hold many events, each of them would be weekly, and would not always be on Mondays, is that correct?

First off all thank you for your help.
Yup you are Correct, one class can be Mondays and Thursdays every week from date 1 to date2.

First off all thank you for your help.
And yes the Classes table, is the header were i determine the coach, Students, court, time, day or days of the week, for exemple every Mondays and Thursdays from date1 to date2.

I can’t think of an easy way to do that within Glide, and specifically on the free plan.

What I would do is use Make + Glide API (on Maker plan) to do something like this:

  • In your form to create classes, add a multiple choice to determine which days of the week you want the classes to be on.
  • Add two fields for “start date” and “end date”.
  • Then comes the hard part, in the Classes table, you have to use your start date, and the weekdays, to determine two things: the actual start date of each loop (if you have multiple weekdays), and the number of weeks this would be looped (can be done through a math column).
  • At the end, I think a JSON would be achieved with structure like this:
{
"weeks": 10,
"days": [
{
"weekday": "Monday",
"startDay": "2024/11/25"
},
{
"weekday": "Thursday",
"startDay": "2024/11/28"
}
]
}

Pass that to Make, loop through each weekday with a Repeator and add rows back to a Glide table.

2 Likes