I have use cases for both examples, but my use cases are more specific.
1 - List Comparison: boolean return compared to strings “yes” or “no”.
List A contains list List B
Imagine you have a conditional statement in a workflow or element that is based on comparing lists: List A and List B.
You need to check if List A contains List B. If you need to use the return only when List A contains List B, then that’s fine, the expression returns a boolean, and you can evaluate whether it’s yes. But the problem is when you need to get the result for no and use it in some logic. Because no here would be the same as using the expression List A doesn't contain List B, but we don’t have that operator available at the moment.
And as you can see, we cannot get the boolean results for both states in this expression. This is why we need to compare the boolean results with strings “yes” or “no”.
Of course, we could use expressions like the intersect with or minus list operators and apply a count to generate a Boolean. That would be another possibility. But again, as I’ve emphasized before, a “doesn’t contain list” operator would be very useful.
Anyway, as I said, this problem happens when you use an expression like this in conditionals. But things change when we use that same expression as a variable, such as the data source of a group defined as boolean.
Because when we do this, then yes, we can get boolean results directly.
2 - Transforming boolean results into calculations.
This is basically used when you need to check several Boolean expressions that will be used to generate a calculation.
Imagine you need to check 5 boolean expressions and based on its return calculate the percentage of something.
So we have:
yes = 1
no = 0
The let’s say the expressions results are:
- Expression 1 = yes
- Expression 2 = yes
- Expression 3 = no
- Expression 4 = no
- Expression 1 = yes
The result would be the evaluation of each of these expressions, :formatted as number and then converted to a percentage.
So…
( Expression 1 :formatted as number + Expression 2 :formatted as number + … / 5 ) * 100
As with the first use case, this is due to the lack of some operators (like these) that would be very useful if implemented in Bubble.
They may not be requested as often, as most users won’t encounter this logic in less complex apps.