Need help with "Search for Users:filtered" Expressions

Hello!

I am trying to write an expression that filters a list of users based on a dropdown with Yes/No options. If yes, search the user list by “a”. If no, search the user list by “b”.

It seems that I need parentheses, but Bubble won’t add them. Maybe I am approaching this the wrong way.

ICYMI:

  • Bubble expressions are evaluated sequentially from beginning to end. You can’t control the order of operations using parentheses.
  • If your list is coming from the database (as opposed to already being on the user’s device), using the advanced constraint requires downloading significantly more data, and, therefore, consumes more workload units, than other constraints, which are delegated to the server.

Consider using separate actions or events to apply the two different filters. Put a condition on each that reference’s the dropdown’s value.

1 Like

Thanks, David. Your suggestion was helpful.

I don’t think I could achieve what I wanted to with a single set of :filtered constraints.

Instead, I moved the filtering into a Workflow. I saved my list data in a state and filtered the state down through a series of only when steps. This seems to be working from my initial tests.

Are there any recommendations on how many list items you can save in a state?

1 Like

Saving searches to states is good practice.

There’s no limit to the list size of a state. Just be wary of the total size of the data returned into that state as it can slow down the filtering.

I once had a state list of 20k text items and pretty sure it went to 30k once. Nothing broke but operating on the state caused locking and I decided to change how I did what I wanted to achieve.

1 Like

Thanks ihsanzainal84!

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