How to display count of a cell that is in the :unique elements of a RG of texts?

If I have a RG of texts, and in each cell of the RG, I want to display the text AND find the count of how many times that cell’s unique text is found in that repeating group’s list of texts, what is the dynamic expression for the text element that shows that count?

Here’s a design to show what it would look like in the repeating group cells:

What I did to solve this was make a Variable search Repeating group of the lists of texts (called “RepeatingGroup A”), and in the repeating group with the tags of the texts in that design (called “RepeatingGroup B”), I put the data source as…

RepeatingGroup A’s list of texts:unique elements

Then for each of the cell’s count for how many times that text appeared in the list, I did the expression…

RepeatingGroup A’s list of texts:filtered:count

Where the “filtered” operation has this constraint…

This text = Current cell’s text

Comment if you’ve found a better way of doing this. Especially for saving WUs.

Hey @bryce, quickest and most scalable way is to let Bubble aggregate the list server-side and send you the counts already baked in:

Search for MyTexts            ← whatever your table is
    :group by                  ← aggregate on the server
        Field to group by = Text

That single expression becomes your RG’s Data source.

How to display inside each cell

Element Dynamic expression
Text label Current cell's Text
Count badge Current cell's count

Because the RG is now showing the groupings, each row is unique by definition and count is the number of times that text appeared in the original list.