In the second ForAll call, the indexer is a table with values ranging from 1..60 (in your case, where there are 12 appointments), so those would be the values of each iteration:
/--------------------------------------------------------------------\
| Indexer | Mod( indexer.Value + 4, 5 ) | RoundUp(indexer.Value/5,0) |
|---------+-----------------------------+----------------------------|
| 1 | 0 | 1 |
| 2 | 1 | 1 |
| 3 | 2 | 1 |
| 4 | 3 | 1 |
| 5 | 4 | 1 |
| 6 | 0 | 1 |
| 7 | 1 | 1 |
| ... | ... | ... |
| 60 | 4 | 5 |
\--------------------------------------------------------------------/
That will create a collection similar to this one:
[
{ AppointmentDate: Date(2024,4,15), AppointmentTime: "8:30" },
{ AppointmentDate: Date(2024,4,16), AppointmentTime: "8:30" },
{ AppointmentDate: Date(2024,4,17), AppointmentTime: "8:30" },
{ AppointmentDate: Date(2024,4,18), AppointmentTime: "8:30" },
{ AppointmentDate: Date(2024,4,19), AppointmentTime: "8:30" },
{ AppointmentDate: Date(2024,4,15), AppointmentTime: "9:10" },
...
{ AppointmentDate: Date(2024,4,19), AppointmentTime: "16:40" }
]
Which can be displayed similar to the image from my original post, in a vertical gallery.
You may want a different organization of your table, though, with the records in a "chronological" order. To do that we would need to revert the indices, using the RoundUp for the date, and the Mod for the time, like in the example below:
ClearCollect(
colAppointmentSlots,
ForAll(
Sequence( 5 * CountRows( colTimeSlots ) ) As indexer,
{
AppointmentDate: DateAdd(
varSettings.'Week Start Date',
RoundUp( indexer.Value / CountRows( colTimeSlots ), 0 ),
TimeUnit.Days
),
AppointmentTime: Index(
colTimeSlots,
Mod( indexer.Value - 1, CountRows( colTimeSlots ) ) + 1
).Value
}
)
)
That would create the "transposition" of the table that was created with the original expression to something like this:
[
{ AppointmentDate: Date(2024,4,15), AppointmentTime: "8:30" },
{ AppointmentDate: Date(2024,4,15), AppointmentTime: "9:10" },
{ AppointmentDate: Date(2024,4,15), AppointmentTime: "9:50" },
{ AppointmentDate: Date(2024,4,15), AppointmentTime: "10:30" },
...
{ AppointmentDate: Date(2024,4,15), AppointmentTime: "16:40" },
{ AppointmentDate: Date(2024,4,16), AppointmentTime: "8:30" },
{ AppointmentDate: Date(2024,4,16), AppointmentTime: "9:10" },
{ AppointmentDate: Date(2024,4,16), AppointmentTime: "9:50" },
...
{ AppointmentDate: Date(2024,4,19), AppointmentTime: "16:40" }
]
And that would make for a better organization of the data if you want to display all items in order, for example (using the new Table control):

Hope this helps!