Count the number of items at various stages (e.g. how many records per kanban stage) in a repeating region

Hi all,

I’m sure this is simpler than I’m making it out to be.

I have a repeating region that’s displaying a single datatype.

Within that datatype I have a reference to another table of another data type. That data type has reference to another table that it uses to reference which stage it’s it.

What I’m trying to accomplish is to count how many of the second data type are at each stage within the first data type.

While this isn’t a Kanban, I thought that might be the easiest way to describe:

My repeat region is listing all the Kanban boards that have been created. In each Kanban I link to ‘Tasks’. and each Kanban has say 5 ‘Stages’.

What I want to achieve is showing how many tasks are at each Kanban Stage in the repeat region, so:

Kanban 1

  • stage-1: 5
  • stage-2: 0
  • stage-3: 3
  • stage-4: 5
  • stage-5: 1

Kanban 2

  • stage-1: 3
  • stage-2: 1
  • stage-3: 0
  • stage-4: 2
  • stage-5: 10

etc.

I have tried nested repeat region, but this doesn’t seem to give me the ability to count on the join table for the second query (the nested query).

I’ve thought of simply extending my workflows and simply adding to the ‘Kanban’ data type 5 new DB fields - and simply add or subtract numbers to those - but I’m assuming there is a way I can do this that’s a little more efficient than that!

Appreciate any guidance here.

bumping this - I know there must be a simple solution!

Maybe use a DB view to hold the counts and incorporate the results in to your query? There may be alternatives to this but if you want to get it done now and then go back to it later when another user can offer you a method then this is a simple solution for the time being…

Thank you for your reply Dave. I need to display this information in multiple locations - so I’d really like a way to handle the number count from the DB globally. I’m probably over complicating things a little - but really getting stuck on the fact that I’m referencing different tables for the status.

You’re welcome mate. Sorry I couldn’t help further.

There must be a simple way of doing this? @George @Teodor

1 Like

No worries, appreciate you trying! This was super easy in Bubble to do, so I’m probably just missing something. Will move on and wait for a reply from George or Teodor hopefully!

There is just a count formatter that you can use on your nested query data

Thanks George, I’m aware of the count formatted but it doesn’t work / present as an option in this use case. Any other ideas?

Where are you trying to apply it exactly? what element is selected and what do you mean it does not appear/work?

Hi Teodor,

Thanks for jumping in. Let me try to explain my specific setup:

in the DB I have the following tables framed as a Kanban use case (to make it easier to explain).

Table 1 = kanbanInformation (such as name of the kanban board, description etc.)
Table 2 = tasksInformation (such as name of the task, description etc. and importantly a reference (link) to the next table ‘taskStatus’
Table 3 = taskStatus (this is simply a fixed table, that does not get edited, it carries 5 rows with an id and the name of the status, e.g. backlog, in progress, completed)

Within the kanban when I open it up, I list the taskInformation’s based on the taskInformation ‘taskStatus’ - and that works fine. I then move them between stages by updating the ‘taskStatus’ via an action.

This all works fine in the Kanban view.

However, what I’m trying to do, is aggregate information to count how many tasks are at each ‘taskStatus’ on a repeating list that shows all kanbanInformations in a users account.

I can create a nested repeat with ‘kanbanInformation’ as the first repeat, and then ‘taskInformation’ as the nested repeat, but as the status is simply a reference link, I don’t seem to be able to ‘count’ each stage, I would only be able to count the amount of ‘taskInformations’ which would mean each data point would be the same.

IS it possible to send us a link where we can check the structure and also what are you trying to sum?

Sure, give me 15 mins and i’ll try and set that up - I’ll dm you the link.

@Teodor sent the link via dm.