How to list events or tasks inside a day or a week? Looking for a way to group product by days (like on Product Hunt?) Here’s a step by step guide, how you can do it.
There are plenty of questions in Bubble forum regarding “nested” repeating groups and how to use them in order to create a task planner (something like this).
“At first glance it seems reasonable to use nested repeating groups to create something like this. You use “mother” repeating group for dates and insert a “child” repeating group inside for events. Sounds like a piece of cake! However, as soon as you begin working on this project you stumble upon a huge problem: repeating groups in Bubble should have data stored in the data base as it’s source. And while you can place your events, tasks or products in the db, you can’t do the same with dates! You can’t possibly think of creating an entry for every date in your app so that your repeating group (RG) refers to it. Besides, it’s a known fact that “nested” RGs are extremely slow and idecrease your app’s resilience. So, what’s the way around? Here what we use in our projects.
1. Use hidden variables pop up.
It’s a pop up that users never see but that can carry in itself lot’s of important data. Think of it as of a header in API calls where you can send important information to the app. In this case I use a group in hidden variables pop up that I set to be Current data and time rounded down to week (for a weekly display of instances).
2. Upon page load
display data in this group : Current date and time rounded down to week.
3. For navigation between weeks
use a group that will display on load a date taken from your hidden variable Group.
So far it’s been an easy part, right? Now for the tasks. I suggest forget about nested repeating groups and use regular group + repeating groups instead.
4. Listing events/tasks within a day or a week
Make 6 equal groups that contain a date and a repeating group of tasks.
All groups will have type of content date. The source – your hidden variable group dates. Group 1 – Hidden var date, Group 2 – Hidden var date +1, Group 3 – Hidden var date +2, etc. Altogether – 6 groups for 6 days of the week The 7th will already belong to another week).
6. Add hiding rules
Finally, add hiding rules to the group in Conditionals tab: if repeating group inside this croup contains 0 tasks, this group should not be visible.
Tell us about your idea to get a discount