Nakul
Nakul

Reputation: 1

ParseQueryAdapter for two classes (nested)

I have two classes "Offers" and "Stores". The Offer class has a pointer field called "storeId" which points back to the "Stores" class. I need to query offers of a specific category, belonging to stores within a 20km radius of my current location. The returned store objects should then be displayed in a list view.

This is my code in the onCreate() method of my ParseQueryAdapter subclass.

ParseQuery offersQuery = new ParseQuery("Offers");
offersQuery.whereEqualTo("category", category);
ParseQuery storesQuery = new ParseQuery("Stores");
storesQuery.whereWithinKilometers("location",myLoc,20);
storesQuery.whereMatchedKeyInQuery("objectId", "storeId", offersQuery);
return storesQuery

storesQuery is returning an empty list.

What am I missing? Also, please ignore ay typos in the above code

Thanks

Upvotes: 0

Views: 30

Answers (0)

Related Questions