Transcript
In this Quick Tip, we're going to learn how to use search constraints when we're using the Do a Search For data source.
Here, we have a repeating group that displays a list of users' names. But let's say we wanted to constrain this list and return only a subset of users that match certain criteria.
For example, we have a few users in our database that have the letter "a" in their name. If we wanted to show only the list of users that have "a" in their name, we would add this as a constraint in our repeating group.
We'll open our Do a Search For expression and click Add a New Constraint. So if we wanted to constrain the search to only find all the users that have "a" in their name, we would add the constraint: Name contains a.
This now reads: Do a Search For Users where Name contains the letter "a".
So when we preview this, that's when our search returns only users with "a" in their name. Where this gets more selective is if we had another field to constrain the search by.
Let's say we want to find all the users who have the letter "a" in their name and that they're an admin, which is a yes/no custom field. We would add a constraint that says: Admin = yes.
And when we preview, we only see the user or users who meet both criteria.
There are many different types of constraints to help pinpoint your search, so experiment with them to find what you need.
That's it for this Quick Tip! For more, be sure to check out bubble.io/academy.