Nested "Do a search for..." :count

Hi guys, I have a question about nested counting.

For example purposes only, imagine that I am displaying a list of Users in a Repeating Group (RG), let’s say 100 users. Now, in another Data Type I have something like Tasks and each task is associated with a user.

If in the RG that I am displaying the 100 users, I do a search on the Tasks data type and return the task count for the user in the current cell, this search for the task count will be done 100 times due to the 100 different constraint in each one (current cell’s user)?

Or to ensure that only one search was done, should I do this task search in another RG (maybe 1x1 pixel) without any constraint and then use the result from this RG to filter it by each cell user in the user RG?

Group by is for this exact reason. You can Search for Tasks and group them by User column and get the count of it:

See the result here:

And this is the data:

You can check the editor: Tests for Forum 9 | Bubble Editor

Ok, so in your example you used the Tasks Datatype itself to display each user’s tasks count and yeah, this works in this case. But imagine that I have a lot of other data types linked to each user. Lets say I have other Datatype called Projects and need to count it too by user. Then in my use case I must use User Datatype as the source of the main RG to get all the other da type info related to each user (in this case, each row of the main RG) and display them. So my question about multiple searches is relate to this approach.

I see what you mean now. In your case, it looks inevitable to do multiple searches.

I don’t know how fast it would make your app but you can get the things you will count and set them on a custom state on the page (on page load) and use these custom states (filtered) for each cell of the main User repeating group.

1 Like