In my app, I’ve input a “Do a search for” and I’m trying to find a way to use constraints which compares two “numeric ranges” and only returns a value if the two ranges DO NOT overlap. I can see the option which returns values if the two ranges DO overlap but I’m trying to find a way to do the opposite. Any advice/suggestions?
Hello,
Sam here, with Bubble support. The best way to achieve this is to put the “overlaps with” expression inside of a hidden text input, and then reference the input’s value being “no.” Here’s a video walkthrough that will explain: https://www.loom.com/share/35193b40de144f46b56e30fc0d24a925
Let me know if you have any questions after watching!
Legend. Thank you so much.
Hi Sam, I’m having a bit of trouble as when I tried implementing this same logic within a repeating group, it didn’t work. I’ve put the “input” which outputs the yes/no within the repeating group so that each “input” correlates to its own cell. However, in the conditionals tab for the repeating group, there is no option to access that “input” and use its value.
The main trouble I’m now having is that I can’t access the “inputs” yes or no value when it’s in the repeating group.
Could you be more specific in describing the details of what you are hoping to accomplish. With partial information it is hard to figure out the best solution. There might be a better approach but it is hard to say without understanding the problem you are trying to solve
For example: I am trying to change the color of the row when the overlap condition is “yes”.
Yes, sorry. It’s a bit complicated but I am trying to make a repeating group which would be used to display different users who are available for a certain period of time on a certain day of the week and whether or not creating a new booking would, 1)Align with the list of users’ availability times and availability days and 2) whether or not creating a new booking would overlap with an already existing booking. I am using data from each user’s availability (eg 8:00 to 15:00 on a Monday and Tuesday) and comparing it with the time period and day that I would enter on this page when live.
I only started using bubble a couple of weeks ago so this probably isn’t the best way of doing it but right now I am doing this using 2 repeating groups. The first one uses conditional statements to filter out users who aren’t available on a given day of the week and displays those who are (this is necessary for me to be able to see this). The second repeating group takes the list of users from the previous repeating group and so far it successfully filters out users who aren’t available at the specific time range using constraints.
Now I need to also make it filter out users who have already got bookings overlapping with the current booking I would be making. I was planning on doing this by simply adding another constraint next to the one previously mentioned and using the “overlaps with” operator but combined with a “not” however there is no option for a “not” to be added to the dynamic constraint.
I then tried doing it by using conditional statements in the second repeating group but I couldn’t get the option for “when current cell’s…”
I then tried the method suggested above in the video by sam.morgan to solve the problem I had in my first attempt however I would have needed an “input element” for each cell in the repeating group which from my understanding means putting the input element into the cell of the repeating group. However, when I did this, I couldn’t access the value of the input at all within the repeating group’s tabs.
Sorry for the really long explanation
Hi Nikola,
Ahh - yes, accessing input elements within a repeating group’s cell from outside of that repeating group is not possible. Any dynamic values that come from inputs within a cell can only be used by workflows that are triggered from other elements within that cell.
Given your recent context, it sounds like you’ve gotten to a point where you have a repeating group that contains all users who are available on a given day and at a given time range. The remaining piece is to remove any users from that list who already have bookings that overlap with the given time range.
Assuming that is the case, you should be able to achieve this by using two more repeating groups.
- Set up a third repeating group of users who already have bookings at the time range. The data source can be “
do a search for bookings where time range overlaps with selected time range:each item's user
” - Set up a fourth repeating group that subtracts the list of RG3 from the list of RG2. So this would be a repeating group of users with the data source “
Repeating Group 2's List of Users minus list Repeating Group 3's list of users
”
This should give you the list of users you’re looking for without having to use the input technique for “does not overlap with.”
Let me know if I missed any context here!
It works!! thank you very much
This topic was automatically closed after 70 days. New replies are no longer allowed.