Reputation: 2979
I have in my app this code:
Globals.mClient.getTable(Action.class).where()
.field("Id").eq("1")
.execute(new TableQueryCallback<Action>() { ... }
But I have a list of IDs and I want get table with items that have the same ID as the IDs in the list.
Like something that:
Globals.mClient.getTable(Action.class).where()
.field("Id")
.eq(listID.getItem(0) || listID.getItem(1) || ...)
.execute(new TableQueryCallback<Action>() { ... }
Do you know how to do it? Do you understand me?
Upvotes: 0
Views: 129
Reputation: 3345
Something like this should work:
int[] listIds= {1, 2, 3};
MobileServiceQuery<..> query = Globals.mClient.getTable(Action.class).where();
for (int index = 0; index < listIds.length; index++)
{
if (index!=0){
query = query.or();
}
query = query.field("Id").eq(listIds[index])
}
query.execute(new TableQueryCallback<Action>() { ... }
Upvotes: 2