Repeater list with data from separate collections

Is there a way to bring data from different firebase collections into one repeater list? Does anyone have any resources on this?

For example, I have one collection called “comments” with the user id of the commenter and the comment(and the post id). I want to display the users name and avatar next to their comment. But the name and avatar is in a different collection, “users.” It is not good to have the avatar url written to the comment collection, because if the user changes avatar, the comments will still show the old one. Same thing with user name. So I need to be able to construct a list using the data from both collections, and somehow make it map the correct avatar to the list according to the user id. And it would also be nice to limit the data variable to only return users who’s ids are in the comment collection, which is limited to the postId, that way it does not consume unnecessary data.

Data is like this:

comments

docId
userId
comment

users
userId
avatar
name

My list to display avatar, name, and comment should be like this

comment docId
userId
avatar
name
avatar

I appreciate it if someone can help me understand how to do this in appgyver, as I will need to do this in many other ways as well.

Thank you.

Just a thought, but how about writing one of the data collections into page variables - and then the repeater loop is just focused on one data set? Not quite sure how this works in practice but maybe something to think through?

1 Like

That is what I am trying to do. First I get the collection comments, then get the data rocord users limited to the ids contained in the comments, so it only queries the users necessary. So I would just set a page list variable and map the correct profile pic to the user id, then repeat the comments card with the custom list. that is my idea anyway. I am just wondering if anyone has done this and the best way to do it. I cannot find out how to write the formula for mapping the keys.

1 Like