Sort by day, starting with current day

Hey there,

just a quick question:

Is it possible to sort a Repeating group by day(date), starting with the current day?

Its about opening hours, which I made work with saving certain dates like MONDAY 15, TUESDAY 16,…SUNDAY 21 and then extract just the days and the hours. That works well, but I am stucked at the point of sorting them by days.

The result must be the following:

If current day is Tuesday: Tuesday, Wednesday, Thursday…Monday
If current day is Saturday: Saturday, Sunday, Monday…Friday
.
.
.
and so on.

Thanks for any help!!!

Hey @daviddr17

Thanks for the post and great question! It almost sounds like what you’re looking for is a combination of sort and constraints. For instance, you can absolutely sort by date, and then you might add a constraint to the repeating group to hide anything with a date that’s prior to today’s date. The result is that your repeating group would always start with today’s date as the first record and then proceed from there.

If you only want to show 7 days, you could limit the number of records that show in the repeating group and you could potentially save your opening hours into an option set where based on the day being displayed in the repeating group, you reference the corresponding option set’s info. Obviously, you could also enter this info directly into a conditional on the content inside the repeating group as well.

Is this what you’re looking for? If you end up with any additional questions, don’t hesitate to reach out to us at Support@Bubble.io

thanks @Andrew.Vernon !

I will give your solution a try, but first I will try to set states of a group which holds opening hours as a list and iterate adding day by day (the next 7 days) to that list. After that I will try to display the list of the state in a RG. I guess thats maybe the easiest solution. I will come back here and let everybody know if it works. :slight_smile:

Alright its working!

just a few screenshots if anybody is interested:

so thats just for the first 2 days, you have to add as many as you want or do an iteration if it should work for a custom amount of items. The process is described in my previous post.

2 Likes