2

I have a class of "work" objects - all have relation to UserProfile class. I want to query for Work objects that are related to local user. That is why I do:

Where<Work> where = new Where<>();
where.eq(Work.FIELD_USERIDID, UserProfile.FIELD_ID, userProfile.getId());
Syncano.getInstance().getObjects(Work.class).setWhereFilter(where).sendAsync(callback);

And I get:

Response{resultCode=1, httpResultCode=400, error='{"query":"Field userProfile cannot be used in a query as it is not indexed."}', httpReasonPhrase='Bad Request', data=null}

What is a correct way to query for classes that have relation to UserProfile and I want only object with relation to particular UserProfile?

Michał Tajchert
  • 10,333
  • 4
  • 30
  • 47

1 Answers1

2

Oh, this was quick. You need to enable Field Fitering on this field (via code(annotation) or Web Dashboard). http://docs.syncano.io/docs/android#section-fields-filtering http://docs.syncano.io/docs/data-objects-filtering

Michał Tajchert
  • 10,333
  • 4
  • 30
  • 47