Count a name in a list

Hi Appgyver,

Is it possible to count how many times a certain name appears in an array of names from a database?

Hi there!

You can do this quite easily with the GROUP formula function.
Here’s an example:

GROUP( [{name:'Amy'},{name: 'Amy'},{name: 'Bob'}] ,, {people: items, count: COUNT(items)})

The first argument is the list to group: [{name:'Amy'},{name: 'Amy'},{name: 'Bob'}]

Second argument is the property name to group by:

Third argument is a formula for the grouped objects: {people: items, count: COUNT(items)}
With items being all the items that belong to the group.

Hope this helps!

Hi @Akseli_Virtanen,

Thank you so much for your reply. I have tried what you said bu ending up getting a red screen :thinking:

I probably didn’t explain it very well. Untitled1
I have this table in my database and I would like a button in my app to show how many times a word/name appears. I have have more than 1 word/name in each cell, not visible on this picture, and I have several tables I would like it to count from.


Hi! Akseli’s solution should work when you’ve adjusted it for what your database looks like. Another way of approaching it is doing something like

COUNT(SELECT(data.YOURDATAHERE, CONTAINS(item.Plant_Group,"Trees")))

Thanks @Mevi, it works :grinning:

Thank you for your help. :+1:

1 Like