Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Parse Compound Queries fail to contain what each individual query possesses.

I'm trying to compound my Parse Queries, however when I do so the Parse Object I'm looking for does not show up.

ParseQuery<ParseObject> mRideList = ParseQuery.getQuery("Ride").whereWithinMiles("StartGeoPoint", OriginLatLng, mDistanceFromOrigin);
ParseQuery<ParseObject> mgreaterdatelist = mRideList.whereGreaterThan("Date", mCurrentDate);
ParseQuery<ParseObject>mequaldatelist = mRideList.whereEqualTo("Date", mCurrentDate).whereGreaterThanOrEqualTo("Time", mCurrentTime);

List<ParseQuery<ParseObject>> queries = new ArrayList<ParseQuery<ParseObject>>();
queries.add(mequaldatelist);
queries.add(mgreaterdatelist);

ParseQuery<ParseObject> mainQuery = ParseQuery.or(queries);
mainQuery.orderByAscending("Date,Time");


mainQuery.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> rides, ParseException e) {
    .....

     //Setting up an array to feed to my adapter
}
//custom adapter }

When I try each of the queries alone it shows up, But after compounding, I get nothing.

Am I compounding wrong?

Also sorry for the poor format, I don't think the website recognizes Parse Code, I tried following proper format.

Edited for formatting. The correct key is the "backtick" or "accent" key which is next to the "1" key on US keyboards.

1 Answer

I looked up the docs on Parse.com and found that GeoPoints aren't supported in compound queries. It looks like you'll need to find a different way to make it work. (Since you're combining results from today and future days, I suggest making a query for results greater than or equal to the current time.)