How do we count when multiple boolean fields are true?

Hi Bubble Community,

If we have three yes/no fields, how can we efficiently create a workflow to update another field: “#count” with how many are “true/yes”? This app does have access to bubble’s API if this is better created there.

Example:
3 = (yes, yes yes)
2 = (no, yes, yes); (yes, no, yes); (yes, yes, no)
1 = (yes, no, no); (no, yes, no); (no, no, yes)
0 = (no, no, no)

Thank you so much for the help.
Jason

image

You can use Completed 1: formatted as number (set yes to 1 and no to 0) + Completed 2:formatted as number + Completed 3: formatted as number

The count will be automatically done this way. You are converting yes to 1 and no to 0. So using + between each of them will give you the expected result.

Completely makes sense, too easy. Thank so very much, @Jici . You’re awesome

1 Like

Similarly, if your Booleans are in a list already (as it looks like they may be), you can just do that_list:formatted as number:sum

(And so you don’t have to worry about how many values there are.)

2 Likes

Simple. Love it, @keith. Thank you very much. Your knowledge and expertise is greatly valued and highly appreciated.

Jason

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.