How to count item by condition?

Hi,

I would like to do an app to shuffle items and add them into a TodoList.
I have 2 lists bucket1 & bucket2
I added an button with a custom action to shuffle and add an item in my TodoList i would like to hide the button if i have 3 items of bucket1 in TodoList and 2 bucket2 in TodoList
How i can count how many items where list = bucket1 and in TodoList?

Thanks

Depends how your data is set up.

I would set it up this way:

  1. A users table
  2. A table with a master list of todo items
  3. A table that assigns todo items to a bucket for each user

The button should add a row to the third table. It should write the todo item, the email of the signed in user, and the bucket number. In this same table, create two if then else columns

  1. “If Bucket A”: If bucket is A then 1 else 0
  2. “If Bucket B”: If bucket is B then 1 else 0

In the users table, create a multiple relation to table 3 via email address. Then do a Rollup (sum) of the “If Bucket A” column. Create a second Rollup (sum) of the “If Bucket B” column.

You now have two columns that count how many task items belong in each bucket for each user. Use these as visibility conditions for showing/hiding the button.

2 Likes

Hi Robert,

Thank you for your response, i will try

1 Like