I have two kinds of data types; “User” and “Booking”. Each “User” will have multiple, unique "Booking"s attached to them (try to imagine that customers would have past bookings, current booking, future bookings, etc.). When a guest starts the booking process, a new “Booking” is created and assigned a random ID (data field = ID, and the random id is its value). In the “User” data type, I have a data field “Bookings” which is a ‘list of things’. When a booking is completed, it’s ID value is added to the "User"s “Bookings” data field.
I want to have a repeating group which will display users with the constraint that their “Bookings” data field contains an ID which matches a “Booking” data type whose data matches the calendar data I pick on the same page. Lots of conditions going on, and I’m not sure how to nest/stack them. Not even sure if I’ve explained it correctly.
I’ve been making great progress but this has become a huge roadblock for me. Any suggestions?
Just to clarify, are you trying to build an app like Airbnb? Where users can post rentals, and other users can book them? Then you want to display the rentals that a User has booked, with the booking information, in a repeating group?
When I select a date from the calendar, I want the repeating group to populate itself with User + Booking, based on the condition that the Users Booking contains an id which matches a booking whose scheduled data matches the data I selected on the calendar… and the be able to pull data values from the matching user and booking.
Yes, pretty much. There’s just two differences, my bookings/rentals are not necessarily created by a logged in user but rather a guest … and each user will have not just one rental, but multiple rentals.
To begin, I think I’d rename the Booking data type to Listing, and then create a new data type called Booking which will contain the Listing, the User who created the booking (built-in), and the dates the User is staying there. I can make these changes if that’s okay with you?
Here are some suggestions on what you can remove/change to make things a little easier on yourself: remove the ID field from Booking because each entry in your app data has a unique ID. In the repeating group which will display the Bookings that a User has, you can use a repeating group (type: Booking), with the data source of “Current User’s Bookings” (which I changed to a List of Bookings instead of a list of Texts). Each Booking has a Listing field within it, which you can display in the repeating group using “Current Cell’s Booking’s Listing’s [field of your choice]”. I don’t want to overwhelm you with changes considering building an Airbnb clone will take a little while, but as for the data structure I’d look over that first and of course feel free to know if I can clarify any changes that I made.
After thinking this over and messing around with it, it isn’t going to work for my needs. Your suggestion was totally on point, given the information/context I provided, so thank you.
The solution would work well if the user was logged in and viewing all of his bookings. But in my case, it’s an admin that’s looking at specific bookings and users. Your suggestion did, however, reveal a feature to me that I wasn’t fully aware of. Had no idea you could make the “type of thing” another data type. So that has me thinking of a different solution, but I’m facing a weird issue…
I have a repating group where its ‘Type of Content’ is “User” and its ‘Data Source’ is “Search for Users (condition - User’s Next Scheduled Date = DateInputA’s Value)”, But nothing shows up!
Any ideas on what I’m messing up? If I can get this to work, I can solve my overall problem.
Got it, no problem! And the reason you’re not seeing anything in preview mode is because you’ve created some data privacy roles where no one can see anything if they’re not logged in, and customers have some restrictions on what they can view/modify even if they are logged in. I would set up a new privacy role called “Admin”, and then allow yourself to view and modify all fields. You can create a new field within the User data type called “Admin” (Type: Yes/No, List: No); the Data Privacy role “When” statement could be “When Current User’s Admin is yes”. Then set your account Admin value to be yes. In the privacy role give yourself all permissions to view/modify User data. Then when you preview that repeating group it will display all the information you need. Right now, even if you’re a User that is logged in, you didn’t give yourself permission to view fields like “Next Service Date” which is a constraint in your repeating group’s search. If you weren’t logged in you won’t be able to see anything because of the privacy roles for ‘Everyone else’:
Right of course! I knew there must be something simple I was missing.
I’ve updated the privacy settings. Now, I can see things like “Current Cell’s User’s First Name” but when I try “Current Cell’s User’s Listing’s Total” Nothing comes up. Still troubleshooting, but hoping someone might know a quick fix.
EDIT: NVM, figured it out. For someone reason, it didn’t like when a manually populated certain data fields. When I went through the process naturally, it worked.
This was a huge roadblock for me, but now I can finally move forward. Thank you so much for looking into all this! Users such as yourself greatly improve the quality of Bubble. I may have given up if it were not for people like you helping. Thanks!
No worries at all - I’ve done exactly the same thing setting up privacy roles and then forgetting about them! So glad to hear that you got it working as you’d hoped! And that is so nice - Thank you so much. Happy to help anytime and feel free to let me know if you get stuck!