How to filter a User List to exclude Current User's Blocked Users

Hi everyone.
I have a user generated content app in which we need to provide the ability for users to block other users.
In the User database, we have added a BlockedUsers (* to *) so that every user can add other users to block.

Now the issue I have is on one of the app screens where we list all users. This screen needs to be filtered out to only display users who are not blocked by the current logged in user. This is where I need help in creating this filter please.
This is what I have.
image

I am not finding the ability to select all User and then add a filter to exclude any user who’s also in the BlockedUsers property.

Appreciate the help as I am stuck and the app was rejected by Apple unless I include this capability.
Thanks

For this I would add a relationship with user (one to many) and name it ‘blocked by user’. When you block a user, update the blocked user ‘blocked by user’ field with logged in user.

Then when filtering you can filter it by saying ‘blocked by user’ does not contain logged in user.

Hope this helps.

Cheers
Craig

Thank you Craig.
However in this case the Blocked User can only be blocked by one user at a time.
image

I would’ve thought it would be a many to many relationship as one user can block many users and a blocked user can be blocked by many users. In this case, I don’t know how to make the filtering work
Thoughts?

Progress here:

image

It works fine now.
Thank you @crmorris2 for steering me into the right direction

A user cannot block themselves so a many to many relationship is not needed here. Because you are only updating one field with data and that data will only be used by an individual user then a one to many is all that is needed.

Glad it worked for you :grinning:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.