Get Data by list of things

I tried to filter the data using the user given list of items from the “list data” column, but Bubble returned no results.

For example, consider the following database records:

  1. dealer, new-user, accountant, manager
  2. new-user
  3. manager, dealer

From this data, I want to retrieve all the records that contain either new-user or manager, which should match all three records. However, when I tried using the “contains” filter in Bubble with these two values, no records were returned.

I also attempted to filter using the “Advanced: contains list” option, but still no records were retrieved. Additionally, I tried using the “intersect” filter, but the issue persisted with no results being returned.

It seems that the “contains” filter tries to match the entire value as a string (with the list values being automatically converted into a comma-separated string), and the “Advanced: contains list” option attempts to match records that have both values at the same time, rather than either of them.



Any idea how to do filter out base on ‘OR’ condition?

Additionally, if I provide a single value for the filter, it works fine! However, the problem occurs when using a list of values.

Try to filter using “tags contains keywords” instead of “tags contains”


There are only 4 suggestions where can I find contain keywords?

Ok, I see. Not having a “contains keywords” option means that your “tags” field is a “list” type. If so, you can filter it using multiple tag constraints (if you have a predefined, not too long list of options that users can choose from).

Example:
Dropdown predefined list of options: dealer, new-user, accountant, manager

Filter:

  • 1st constraint: tags contains Dropdown value “dealer”: formatted as text (if “yes” then Dropdown value, if “no” then empty)
  • 2nd constraint: tags contains Dropdown value “new-user”: formatted as text (if “yes” then Dropdown value, if “no” then empty)
  • 3rd constraint: tags contains Dropdown value “accountant”: formatted as text (if “yes” then Dropdown value, if “no” then empty)
  • 4th constraint: tags contains Dropdown value “manager”: formatted as text (if “yes” then Dropdown value, if “no” then empty)

To have this work, you need to have “Ignore empty constraints” checked.

If the above is not the case, then maybe you can change the “tags” field type to be a single text field (not a list type) where particular tags are separated by some unique separator. With this, you will be able to use the “contains keywords” expression.

Thank you for the answer. If it’s pre-defined, it will work, but the list is dynamic, with hundreds of tags and no limit. Users can create whatever tags they want, and that’s the issue.

If so, then I will go with a simple text field where tags are separated by some unique separator like // or $$. It will be super easy to manage this approach or create a list of tags if necessary.