1

I have User and GroupMember Class with parse.

I have a added a User pointer column in GroupMember Class and wanted to fetch all users from User Class but excluding which are present in GroupMember Class relation.

Preetam Jadakar
  • 4,479
  • 2
  • 28
  • 58
  • would you please give some examples such as GroupMember has these rows and columns and User has these rows and columns with values in them. Fake data in these values will work. We just need to know the specific logic you're looking for so we can give you the best answer. – Henry Situ Nov 02 '15 at 19:19

1 Answers1

1

You have to make a two queries where You query all the users objectId from GroupMembers pointer column and then exclude those objects from the next query on User class.

ParseQuery<ParseObject> a = ParseQuery.getQuery("GroupMember");
a.include("name of pointer column")
a.findInBackground(new FindCallback...); // get list of objects id with for each loop 
//i.e. for (ParseObject o : list) String s = o.getParseObject("user_pointer_column").getObjectId(); 
//then add it to some list

ParseQuery<ParseObject> b = ParseQuery.getQuery("User");
b.whereNotContainedIn("objectId", list_of_ids);

Or the other way:

ParseQuery<ParseObject> a = ParseQuery.getQuery("User");   
ParseQuery<ParseObject> b = ParseQuery.getQuery("GroupMember");
b.whereDoesNotMatchQuery("user_pointer_column", a);
b.findInBackground(new FindCallback...{...});
jean d'arme
  • 4,033
  • 6
  • 35
  • 70