Aggregate data binding inside a Container + Iterate Data Source

Hi again,

I’m using a container with “Iterate Data Source” to render out a list of Posts. And I want to show (like in this forum) the count of replies tied to the post in this view. But I’m not able to make it work. I tried to set up a data source where the filter is tied to the “selected” source but that only works if you go into a post and back. But for only that post.

Is there a way to ask the data binding to use “context” instead of “selected”?

BR, struggling AppFarmer.

Hi,

You can get the number of replies with the use of the function editor.

  1. Click on the text component you want to display the number of replies. (Make sure this is somewhere inside the posts iterator)
  2. In the property pane on the right, for the “text” value, click on the 3 circles and then “Function”
  3. In the function editor, add in your “replies” datasource with the “+” sign.
  4. Select the newly added datasource and under selection in the bottom right corner, select “filtered selection”
  5. Set up a new filter where reply.post EQAULS post
  6. The newly filtered datasource will now hold a number of objects equal to the number of replies for the post in context
  7. In the function editor write the following code to return the number: return replies.length

Hopefully this will solve your problem :slight_smile:

Awesome this worked for me. Thanks!