There should be a way to group list of texts and numbers

So i got a list of tags that I want to find the reoccurrence of:
[ “tag1”,“tag2”, “tag1”, “tag1”, “tag1”, “tag1”, “tag1”, “tag3”, “tag2”]

and usally if it were objects theres a group by function thats really useful, but it doesnt exist for texts and numbers, so I have to do complicated login and write my own code in order to do this successfully.

Hi Darren.

If I’ve understood correctly, you can do this with a slightly different approach.

Let’s assume you have a state containing a list of texts (your tags).

You can have a repeating group that shows that list, with the setting “:unique elements”, i.e. so you only get the de-duplicated list.

In each cell you can show the current cell’s text (i.e. the tag name), then add another text box that is set something like this:

my state’s Texts : filtered (constraint: this text is current cell’s text) : count

That will give you the grouped count for each tag.

Hope that helps, but let me know if not.


Hi James - Reviving a somewhat old thread here but I have a question on your approach. Given the :unique elements approach, would there be any way to sort that list of texts by count (e.g. for display in a repeating group)?

In case anybody else is trying to sort a repeating group that’s a list of texts: I was able to sort it using some custom Javascript and the Toolbox plugin. What I was really trying to do was to take a repeating group of texts and use the Group By / sort functionality from Bubble, but alas it’s not available for lists of texts.

I wrote a quick javascript function that takes the list of texts from Bubble and sorts it. Then I return that sorted list (via bubble_fn_[ ]) to a Javascript to Bubble element. Finally, in my repeating group, I added a condition where if the Javascript to Bubble element’s value list is not empty, make the repeating group’s data source be that Javascript to Bubble element’s list.