I’m trying to get the photo and name of the user who left a comment. Since the user’s id is stored in ownerid, i’d trying to retrieve the linked information.
Yes. It is saved in “ownerId” of the “Comment Table.” The string is a clickable one, which when clicked opens a filtered “Users” Table with only that user’s details.
I am asking if in your client program you know objectId of the use for which you need to load the name and photo.
Also, it would be amazingly helpful if you could provide the following information:
where does your app store comments?
are they in a separate table?
is there a relationship between users and comments?
is name and photo stored in the user objects? If not, where?
We’d love to help out, however, with the vacuum of information and cropped images showing very little helpful info, it makes it extremely difficult to write any kind of meaningful query to show you how to get things done.
Sorry, I cannot help with the code. Here’s what I would need so we can help you:
Please attach screenshots from Backendless console showing the schema for all the tables you’re working with. The schema is located when you click this button for any given table:http://support.backendless.com/public/attachments/a9aa106de2161eeb4cfe52cfa58cda56.png</img>
A screenshot of the user properties screen from backendless console. The screen is available when you go to Users > User Properties.
Thanks,
Mark
ownerid is automatically added to every table, right?! If the user is logged in, the user’s objectid is put in there for each new post / comment added. how do you get all of the user’s information based on the id stored in ownerid? that’s really what i’m asking…
in your own screenshot, when you click the blue links in ownerid, you’d understand what i mean, i think?
The following assumptions are made for the following code:
There is a logged in user
There is the Comment class which is created by users and ownerId is set for the Comment objects:
let dataQuery = BackendlessDataQuery();
dataQuery.whereClause = "ownerId = '\(backendless.userService.currentUser.objectId)'"
// get all the comments created by user
let collection:BackendlessCollection = backendless.data.of(Comment.ofClass()).find(dataQuery)
// as an example, get the first comment
let commentObject = collection.getCurrentPage().first as! Comment;