How to filter users

Hi, I’m building an app where the user (organizers) subscription’s “Active” needs to be yes for their events to remain published. I wanted to search for events who’s organizers subscriptions active is no and unpublish those, but I can’t do that. So I’m trying to search for users who are organizers and who’s subscriptions active is no, and then change each of their events published to no. But I can’t do this either. Can someone please explain why I can’t do this in this situation? I need to get the subscriptions active status, but my only options when filtering are the standard =, ><, is in, isn’t in… etc. I don’t understand why the fields of the subscription data type don’t show up as an option to filter further. I’ve run into this problem with other Bubble projects also. Can someone explain why and possibly suggest a solution? Thank you!

You can’t access fields on a related record directly in a search constraint like that. The standard way to solve this is to use the `:filtered` operator after the ‘Do a search for’. then user advance option and then usr This subscription Active isn\'t yes this will give you all the user.

also check your privacy rules does this active field is visible to every one.

Another way i suggest is use a database triger, Use it whenever a subscription updated , it will triger and giveyou two thigns, Old & New old is the same data before this tirger happend and new is the data after this triger.

you can check Old active is not New active && New Active is NO this mean the active field changed and the active field is no longer yes. then you can do whatevery you wanted to do.

if you stuck i will help you for free ping me any time.

1 Like

Hey @Boothmate! This happens because Bubble’s search constraints only let you filter on fields of the type you’re searching, so you can’t directly access deeper fields like a Subscription’s Active status. The way to handle it is to first search for the Users who are organizers, then use :filtered on that list to check if their Subscription’s Active is no. After that, you can run an action on each item in the filtered list to unpublish their events.

This approach works around the limitation and lets you access related fields that don’t show up in the standard search.

1 Like

Thank you! I used the advanced option and that worked. I also started looking into database triggers to learn more about them. I appreciate your help!

@Boothmate Pleasure is mine, if you like i can show you how you can set them up.

Ping me here LinkedIn or WhatsApp me through my portfolio site link.

Will find a suitable site and i will show you how you can set trigger, trigger is much better and cost effective as you dont need to search layout database with advance and its instanious as when ever a sub became un action we limit user access.