Filtering on nested and/or conditionals

Hi all, I’m constructing an advanced filter and not sure how to introduce nested “and/or” conditionals in the advanced expression. What I’m trying to do is like the following:


something = something else
AND
(
(
thing’s attribute 1 = xx
AND
thing’s attribute 2 = yy
)
OR
(
thing’s attribute 2 = zz
AND
thing’s attribute 3 = aa
)
)
AND
something more = something else more

etc

Usually this is done by introducing parantheticals to influence how to interpret the and/or chain. Example: “1 and 2 or 3 and 4” can be interpreted as (1 and 2) or (3 and 4) as much as 1 and (2 or 3) and 4, which would yield vastly different results. But I see the advanced filter expression builder doesn’t seem to support the parantheticals. So does anyone know how the Bubble engine interprets the order of and’s and or’s by default? Is it in the order the conditions are introduced, such as (((1 and 2) or 3) and 4)? Any way to influence how they’re interpreted?

Thanks in advance!

The formatting was not so great there after whitespace got scrubbed (sorry, first post).
Better seen more concisely as:

(thing’s attribute 1 = xx AND thing’s attribute 2 = yy)
OR
(thing’s attribute 2 = zz AND thing’s attribute 3 = aa)

They get evaluated left to right.

More detail: How to combine AND and OR operators? ...Continued

1 Like

Excellent post, thanks Keith. Was searching and couldn’t find that one.
So do you know how you might solve an (A and B) or (C and D) expression left to right? I have a feeling it might involve a different trick.

Well, you’d basically have to precompute C AND D, like create a boolean state somewhere (let’s call it E) and then in your workflow, right before where you are trying to use (A and B) or (C and D), set that state to C AND D. And then your condition in the next step becomes A AND B OR E.

(And yes this is slightly stupid.)

2 Likes