Need Help Setting Multiple Constraints & Selecting Mult Options from Option Set on RG

I need help setting multiple constraints on an RG, with one of the constraints being set on an option set.

Background: In an RG, I am trying to pull all transactions (valets) created by a user (constraint #1). The valets are assigned statuses from an option set (e.g., scheduled, in-progress, driver enroute, etc.). So, I only want to show those valets with a certain status (or statuses) (constraint #2).

When I set the two constraints and set the option set to a single/specific status, it works. They RG returns all valets created by the user and only returns valets with the particular status.

However, when I modify the second constraint further, to include multiple statuses from the Option Set (using the “merge with” function), it ignores the first constraint (that it should only return those created by the user). It displays all valets in the database with those statuses (created by all users).

image

‘Merged with’ does exactly what is says… i.e. it takes two lists and merges them into 1 list.

So, your first list is a list of Valets created by the Current User, with the Status ‘Driver Assigned’

Your second list is a list of Valets, created by ANYONE with the status of Scheduled.

So the resulting list will be both of those lists combined.

Therefore your results are showing exactly what they would be expected to show.

If you want to limit the results to only those created by the Current User, you’ll need to add that constraint to both your searches.

However, I doubt this is the best way to do things here (not to mention, under the new pricing model, doing 2 searches will cost more than doing 1, even if the difference is only slight)…

Obviously it depends on your UX, and the specifics of what you’re doing, but you’d be better using a list of Statuses, then doing a single search with a constraint that the Valet’s Status is in the list of statuses.

If you’re allowing Users to select Statuses to filter by then you can just use whatever element they select statuses from (i.e. a multidropdown) as the list to compare to.

If not, then define the list in a custom state somewhere.

That way, you can just do a single search, which will not only be faster, but also (under the new pricing model) slightly cheaper.

1 Like

Hey Adam, sorry for the late response; took some time off Bubble a bit, and just getting back to it. But man…thanks a lot for the guidance you provided. Based on the points you made, I was able to set it up using the “filter” function, and it worked really well. And I’m glad you pointed out concern about the impact under the new pricing structure…my initial approach could get pretty expensive pretty fast. I was not thinking about that until I read your response. In fact, I need to really read through it and see how it’ll affect my app…I didn’t think about it. Thanks again, and I truly appreciate the help!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.