How to retrieve a list of objects with objectid

Is there a way to pass a list of objectids to Backendless.find and retrieve the corresponding records as a list? How can I implement this?

Hi.
I do not know what api you use.
But in common you can just create where clause where all objectIds will be pointed.
objectId in ('id1', 'id2', ...)

How to create requests with where clause is described in our documentation.

Thank you, this is exactly what I wanted. But what happens if one of the objectids is not found?
Will I get a list of the records found or will the entire operation be aborted with error?

1 Like

You’ll get the list of only existing objects.

Thank you

Can’t I use a user defined field in this manner? For example am not getting any response with
ProductId in ('id1', 'id2', ...)

Hello @Nkekere_Tommy_Minimann

Yes, you can

Is this ProductId a String column?

Yes it’s a string column. But response.size is giving me 0

Have you tested your where clause in Backendless REST Console?

Yes sir. ProductId in (‘AN3x388PlGH’) works in the REST console, but ProductId in (‘AN3x388PlGH’,‘BOnz5gTUXz4’) Says invalid whereClause

Make sure to use this character for single quotes:

'

Mark

Yes that’s the same character am using

I edited my answer, see above

There are only 2 of such single quotes on my keyboard. When I use the other one like this
ProductId in ( AN3x388PlGH , BOnz5gTUXz4 )

I get Column AN3x388PIGH does not exist in the Master table

`

could you please share your appId? and provide what table you use for getting this records

I’ve now done it correctly,
ProductId in (‘AN3x388PlGH’,‘BOnz5gTUXz4’,‘art’)
Works in the REST console but am having problems with making it work in code

C2AE98FF-1A1D-BF10-FF3E-64CD97C40D00
Master table

I’m glad to see you handled it :+1:

Do you use our SDK? what lang do you use?

Java SDK

Could you set a breakpoint in the code where the where clause is being composed and show what it looks like in the debugger? (please attach a screenshot)