Sumif type calculation

Hey @bryan.holmes - for a list of numbers, the “sumif” operation (as found in spreadsheets) is just a filter, followed by a sum, in Bubble.

So like, I have a list of numbers [1,2,3,4,5,6] and I want to “sumif” value is > 2 (result 18) we can do that as:

list :filtered (advanced filter: this item > 2) :sum

Which is similar to how we might do it in JavaScript (.filter is the filter function and the .reduce is a way to sum the resulting array):

[1,2,3,4,5,6].filter(item => item > 2).reduce((acc, v) => { return acc + v}, 0)

And no, Repeating Groups are not computational elements even though people might want them to be. I talk about that a bit in a recent video here, if you’re interested:

1 Like