Forum Academy Marketplace Showcase Pricing Features

Complex search matching same values in two lists

I am having trouble displaying entries in a repeating group. Can somebody tell me if the following approach can work?

I have an app to manage registrations in an organisation. I created the following database structure:

I defined the type “Departments” which the administrator can create in the setup:

Each department is related to the company of the administrator:

Administrator can register users. These users can be related to multiple departments (Departments2)

When a registration is created, it can be related to multiple departments

Now users should be able to see all registrations were registrations departments list values is current users department lists values. The problem here is that I cannot say “is” because it are lists. I have read about the filter of contrains but every time I try that I end up in a loop. I have no idea what to choose after :filter (More)

So I have two questions

  1. Is this database setup the right approach?
  2. If so, how do I filter on departments. Whatever I do, it stays red.

Does the Registration Department list need to be an exact match for the User’s Departments2 list? Or just needs to intersect at least 1?

“Contains” isn’t working for you because that operator is looking for 1 item. “List contains 1 item”… “Departments contains 1 department” … not “Departments contains list of Departments.”

Let me know about the question above and I’ll help you out with the logic.

Gaby | Coaching Bubble

Hi Gaby,

Thanks for explaining so far. It does not need to be an exact match. But let me explain with an example:
Registration 1 is related to Department 1
Registration 2 is related to Department 1 and Department 2
Registration 3 is related to Department 2

User 1 is related to Department 1 and Department 2
User 2 is related to Department 2

What I would like to achieve is that the user will see in the repeating group the Registration of the department(s) he/she is related too. In this case:
User 1
Registration 1
Registration 2

User 2
Registration 2
Registration 3

So in other words if registration and user relate to the same department then the registration will show up in the repeating group of that user.

Hope I explained it well.

Hi @j.poolman, excellent breakdown. Thank you! If I’m not mistaken though… in your example, User 1 should see all 3 Registrations, right?

Try this:

I think this set up is fine - I’d need more info about how your app needs to work with all these types of data to advise on potential restructuring. In theory, you could also save a list of Registrations directly on the User, but if for whatever reason that doesn’t seem logical, then don’t do it. However, it would make this particular search much more efficient AND you’d keep the search on the server (Bubble’s) side. Whenever you use the :filtered modifier, you’re passing the search onto the client (user) side, which may slow things down depending on how much data and how much filtering you’re doing.

Gaby | Coaching Bubble


Hi Gaby, yes you are right. It was a bit late last night :slight_smile:

I don’t think the registration can be saved only to the list of the user directly as this registration will be initiated by a user and then related to other users, other departments, other processes in the company. The foundation of the app is that a user creates a registration and then relates to all kind of relation elements in the company. Users in the app who are related to one or more of these relation elements can then show or interact with the registration.

Thank you for your setup. I managed to replicate your setup (took a while before I realised that I had to click directly behind “Search for Registrations”) but it does not work. No registration is popping up in the repeating group. What does count > 0 mean? Look into the two lists for departments who are equal and show all items counted above 0?

I still do not understand everything of the constrain part but if i click on Search for Registrations and the second block moves to the left, it turns red

But if I click on the “:filtered” it’s blue

When this is functioning, My plan is to create a seperate relation table (I allready tested that and it works as long as the relation fields are not a list) and connect that to all types which need to have a relation. So users, registrations, etc get one relation field of type relations. Is that a logic approach? Otherwise I end up creating relation fields in each type table I want it to be related.

Real quick here:

The search constraint (what is showing up in red for you) and the filter constraint (in blue) are separate things. Remove the search constraint to clear the issue and try it again.

Searches can have constraints… Eg, search for all users whose country is USA. The filtered modifier would get added to filter that search… eg. Filter the USA users with gender = male.

These constraint options are very very similar. The difference is that search constraints happen on the server whereas filters happen on the client. You want to keep constraints on the server as much as possible for optimal performance. However, there are some filters that are not available as a search constraint, such as the “advanced” filter I used.

The expression in the advanced filter is saying …filter the list of registration by number of departments that match the current user’s departments … if more than 0 intersect, that means at least one department matches… So we want to see it.

1 Like

Hi Gaby, I deleted everything and did it all over again and that worked! Thank you very much. Did I mis a lesson about these differences of client side / user side or a missed chapter in the manual? Or is this knowledge simply only available on the forum?

1 Like

Great! Yeah, it’s not very loudly stated. Partial mention of it here:

I also suggest you check out this thread: