How to do a simple count

HI All, fairly new to bubble but loving every minute of play time. However a simple problem I know has a simple answer but brain is fried. I need to count the number of times a particular word appears (lets say “billy”) in a data set list of fields and then display the total count in a input or text. The count needs to be of all fields (e.g user name). Surely there is a simple solution - please help, driving me crackers lol.


Do you mean all fields of a data type? All the database? Can you post an example of a sample data type with some fields and the result you would like to see?

Hi there, @stephen.langston… if I understand your post correctly, an expression like this one should do the trick.

You will also need to make sure that any privacy rules on the associated data type don’t get in the way of the search.

Hope this helps.


1 Like

Thanks MIke - on the right idea here but I was using user as an example. Lets try again lol. I have an input that needs to display the number of times a word that is in a different input appears in a data set of fields. Then the number of times it appears in those fields is displayed in the original input. In your above example I would presume the Type is my data set, the constraint full name would be the text value in my second input box and - search for users: count would be search for my data set:count. Am I making this easy thing very difficult lol. Sorry to bother you all.

Echoing @hergin’s questions, what do you mean by a data set of fields? Do you mean a specific field in one data type? If so, search that data type, and add a constraint to the search where the field in question contains keyword(s) found in the second input’s value.

If that still doesn’t make sense, share some screenshots, especially of the data type in question and field(s) you want to search.

Let me take a stab at this @stephen.langston

The count:

  • set up a group of type number and call it countOfThings
  • for its data source add the search with any necessary constraints which should look somewhat like this “search things each item name count”
  • countOfThings should now be available to be displayed or placed where it is needed on your page

Please let me know if hit the jackpot or missed the mark completely :smiley:

Many thanks MikeLoc for influencing my brain. I got it with some adjustments to your advice. Much appreciated - and thanks to the others for suggestions. :slight_smile: