Support Topics Documentation Slack YouTube Blog

How to iterate through with users id in Dataquerybuilder

Tried this it wasn’t returning any response.

could you please provide with us what “whereClause” string has been sent to the server?
Have you tried to test the “whereClause” in the REST Console in Data Section?

OK just like u said in the previous code given.

I made an arraylist first with the idenifier “query”

Arraylistquery = new Arraylist<>();
After this I iterated the response Of The people the current user is following. Let say the response is 5.

Getting the current user Id.
String Id = connection.getuserId;

Setting the where clause in the querybuilder.
Querybuilder.setwhereclause(“Owner_id IN (’”+id+"’, ‘"+query+"’)");
Now setting d query to
Backendless. Data. Of(broadcast).find(query, asy)
But it returns that Of the current user alone and the other query been left empty.

I believe you need to change “Owner_id” to “ownerId”.

please provide how this “whereClause” looks like after all calculation

Even with changing to ownerid it’s still return the same thing. Just that Of the current user. Leaving the array blank

ownerId I mean

please provide how this “whereClause” looks like after all calculation

could you please print the value and share it with us?

Regards, Vlad

Don’t mean to disturb but by value what really do u what or what really would u like me to send back. Wouldn’t want to send the wrong details.

I’m talking about this one

Querybuilder.setwhereclause(“ownerId IN (’”+id+"’, ‘"+query+"’)");

please print this value into log output

Log.d(TAG, “ownerId IN (’”+id+"’, ‘"+query+"’)")


ownerId IN (’[8F853961-7DBB-DE4F-FFDC-9F371F5D1200, 56F72132-BAC2-7C93-FFE9-3F28C0BFED00, 6A630BBA-C7E7-54D3-FF97-991201D30B00]’, ‘AEDF902B-CD0C-9214-FF14-99453CAF0500’)

as you can see the value is not corrected, each ObjectId must be wrapped with quotes

ownerId IN ('8F853961-7DBB-DE4F-FFDC-9F371F5D1200', '56F72132-BAC2-7C93-FFE9-3F28C0BFED00', '6A630BBA-C7E7-54D3-FF97-991201D30B00', 'AEDF902B-CD0C-9214-FF14-99453CAF0500’)

am guessing it’s the arraylist.

Cause I did retrieve the people the current user is following using an api call which is correct then iterate them to an arraylist.

Like this
Arraylist array = new Arraylist<>();

//response here is the result of all the user the current user is following.
For(i=0; i<response.size; i++){

So am I wrong in this aspect?

OK so how do I get my result to return this

do you mean how to compose this string: ownerId IN ('8F853961-7DBB-DE4F-FFDC-9F371F5D1200', '56F72132-BAC2-7C93-FFE9-3F28C0BFED00', '6A630BBA-C7E7-54D3-FF97-991201D30B00', 'AEDF902B-CD0C-9214-FF14-99453CAF0500') ?


try to wrap each objectId into quotes in your loop and then concatenate it into a single one string, check what you’ve got by printing it into output

Sorry to bother u but I am having a little problem with it could u give me an example, OR just a rough work of how to do this.

Hello @vladimir-upirov.
How about this can I get the all user the current user is following by retrieving them from relation?

Please provide your DB schema, how followed users are related to the user

Arit. I made the current user follow some users and on the Users table I had created a column named “currentUserIsFollowing” and made a relation to Users table to the users the current user is following. Now I want to retrieve them all so as to get their post.