Create query for retrieving with Where clause

I have a user object and in the object blockList field which is list of BackendlessUsers.

How can I use this query “AND ownerId NOT IN (‘id1’, ‘id2’,…)” in my case
I need something like this
“AND ownerId NOT IN (blockList.everyObject.ownerId)”(pseudo code)

Hi,

what about to store list of id’s instead of BackendlessUsers? Is it possible in your case?

Hi
you mean like this?
AND ownerId NOT IN (’((self.backendless.userService.currentUser!.getProperty(“blockList”) as? [String]))’)
this doesnt work

Hi Narek,

Can you please check the same query in the Data Service console?

Could you please write the example of where clause which does not work and test it in the admin console? There you can find a switcher to SQL right to search input and type SQL expressions like yours.

Check that there are no null’s in block_list field, it may cause code not working.

Waiting for your response with results.

ok will tell you tomorrow

I have the similar question.
Have:
class A {
List<BackendlessUser> users;
}
For example, how to query all A objects with where “users.objectId = 17E0F4A1-DFCD-128B-FF08-3C040B792C00” ?

Hello, use nex example

BackendlessDataQuery dataQuery = new BackendlessDataQuery();
dataQuery.setWhereClause( “users.objectId = 17E0F4A1-DFCD-128B-FF08-3C040B792C00” );
List<Map> result;
result = Backendless.Persistence.of( “A” ).find( dataQuery ).getCurrentPage();

Unfortunately, it is no work.

Oh… I solved problem. objectId should be in quotes:
dataQuery.setWhereClause( “users.objectId = ‘17E0F4A1-DFCD-128B-FF08-3C040B792C00’” );

1 Like