Support Topics Documentation Slack YouTube Blog

How to iterate through with users id in Dataquerybuilder


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.

Hope you’ll get how to make it using Android SDK, but here is an idea using JS:

let currentUser = await Backendless.Users.getCurrentUser() // retrieve current user
let relationsQuery = new Backendless.LoadRelationsQueryBuilder() // create relations query builder
relationsQuery.setRelationName('currentUserIsFollowing') // set relation column you'd like to fetch
let followingUsers = await Backendless.Data.of('Users').loadRelations(currentUser.objectId, relationsQuery) // fetch relations for specific (current) user, result is a list of following users

Also I would recommend to take a look on our Blog Post serie “How to build a Social App Backend using Backendless”.