Paul Alexander
Paul Alexander

Reputation: 2748

Android - Parse Query - need to know if a string is contained within one of multiple columns in my database table

I have an Android application using parse as a backend. One of my tables in my parse database contains groups of users, one row in this table contains 6 columns of users to form one group.

I would like to return each row where the current user is contained in one of the columns.

My question is what is the most optimum way of achieving this?
As it stands I can think of two ways:
1. query each row in the groups table and loop through each cloumn looking for the current users username.
2. if possible - use a parse query that says if currenUser equals member 1 or member 2 or member 3 or member 4 or member 5 or member 6. But I don't know if this is possible

Any pointers or help would be appreciated?

Upvotes: 0

Views: 477

Answers (1)

Nitesh
Nitesh

Reputation: 3903

For your ParseQuery<ParseObject> query object a whereEqualTo method is available query.whereEqualTo(key, value); try using your column name in place or key and your desired value in in place of value.
Using this you will only get the rows which contains your desired values. It just works as the where clause in SQL qyery. so you will not need to iterate over all the DB entries.

Upvotes: 1

Related Questions