5

I am looking to combine two parse queries into one which satisfies an 'OR' condition. How do I achieve this? The docs say that I need a list of parse queries but I am not very sure how to do that ? Here is my code :

ParseQuery<ParseUser> numberQuery = ParseUser.getQuery();
        numberQuery.whereNotEqualTo("objectId", currentUser.getObjectId());
        numberQuery.whereContainedIn("phoneNumber", values);
        ParseQuery<ParseUser> emailQuery = ParseUser.getQuery();
        emailQuery.whereNotEqualTo("objectId", currentUser.getObjectId());
        numberQuery.whereContainedIn("email", values);
        ParseQuery<ParseUser> superQuery = ParseUser.getQuery();
        superQuery.or

How do I complete this query and get the 'OR' of the two in superquery ? Thanks

1 Answer 1

16

Okay I figured it out myself. To create a list you use

    List<ParseQuery<ParseUser>> queries = new ArrayList<ParseQuery<ParseUser>>();

and then

queries.add(q1);
queries.add(q2); 

and so on. And then you use

ParseQuery<ParseUser> superQuery = ParseUser.getQuery();
        ParseQuery.or(queries);

to get the final combined query.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.