Reputation: 2667
In Parse for Android, is it possible to AND multiple OR sub-queries? I've been attempting to combine two OR queries with no luck. From what I've researched, Parse may not have this capacity; I haven't been able to find anything to confirm/deny that, though.
For example, given a bunch of List<ParseQuery>
objects, I'm finding that a similar setup as below only performs the queries associated with myList1
. Is this a result of how Parse handles ORs?
ParseQuery myQuery = new ParseQuery("myTable");
// ...
myQuery = myQuery.or(myList1);
myQuery = myQuery.or(myList2);
myQuery = myQuery.or(myList3);
// ...
myQuery.findInBackground(myCallback);
Upvotes: 3
Views: 3896
Reputation: 6949
No, it doesn't work that way. ParseQuery.or() can only OR Parse queries.
ParseQuery myQuery1 = new ParseQuery("myTable");
myQuery1.whereContainedIn("key", myList1);
ParseQuery myQuery2 = new ParseQuery("myTable");
myQuery2.whereContainedIn("key", myList2);
List<ParseQuery<ParseObject>> queries = new ArrayList<ParseQuery<ParseObject>>();
queries.add(myQuery1);
queries.add(myQuery2);
ParseQuery<ParseObject> mainQuery = ParseQuery.or(queries);
Now the mainQuery is equal to whereContainedIn(myList1 OR myList2)
.
Upvotes: 19