Hello,

I would like to display Users in my dropdown that have the Role “Admin” OR “Gestionnaire” OR “Enseignant”.
How can I achieve it, right now it’s doing the AND operator.

Thx

Use the :merged with operator, to combine 3 searches into a single search.

So, search for users who’s Role contains Admin, merged with a search for Users who’s Role contains Gestionnaire, merged with a search for Users who’s Role contains Enseignant.

That will perform just a single search, returning all users who meet any one of the 3 criteria.

1 Like

Is that right? Bubble literally consolidates the multiple searches into a single search fully delegated to the server? Or, do you just mean that in practical terms what are literally 3 separate sequential searches yield the same result as if it were a single search?

FWIW, my approach in this type of situation is typically: Role is in Arbitrary text:split by ,, with Admin,Gestionnaire,Enseignant in the Arbitrary text

Yes.

Bubble literally consolidates the multiple searches into a single search fully delegated to the server?

Correct, the :merged with operator (at least in this context) merges the expressions into a single DB query.

Or, do you just mean that in practical terms what are literally 3 separate sequential searches yield the same result as if it were a single search?

Nope, I mean only single DB query will be made.

FWIW, my approach in this type of situation is typically: Role is in Arbitrary text:split by , , with Admin,Gestionnaire,Enseignant in the Arbitrary text

That would work if your Role field is a single Text (although I wouldn’t recommend using Text for Role fields).

But, in your case the Role field is a list - hence why you can’t do it that way.

1 Like

This really is an underrated operator! While it’s obviously worth avoiding if possible to save a bit of WU and maximising performance, it does essentially function as a native OR operator for any list.

1 Like

Thanks for confirming. That’s great to know.

I didn’t see in the OP that the field is a list. Of course, is in wouldn’t be applicable there.

Absolutely–I was just referencing the OP’s specific query as the example. In my own apps, role is always a data type or option set. Good reminder to all that making a user’s Role field a literal text value creates lots of opportunity for errors throughout the app.

1 Like

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