Boolean Logic UIs are difficult to interpret.
The main problem non-technical users have with Boolean logic is understanding the difference between AND and OR because it doesn’t always correspond to natural language (e.g., “show me orders from New York and New Jersey” almost certainly means Location = NY OR Location = NJ). Often users tend to interpret “or” to be an exclusive OR. Then there’s the issue of losing track of nested parentheses.
If you’re planning to use Boolean logic in your UI, you should test it to ensure that it’s understandable. Here are some common errors users make that you as the UX designer should watch out for:
- Confusing AND and OR (e.g., OR instead of AND).
- Using a single OR rather than a double OR (e.g., OR instead of || ).
- Forgetting parentheses in nested logic (e.g., (NY OR NJ) OR (CA OR TX) instead of (NY || NJ) || (CA || TX) ).
- Neglecting the use of parentheses in complicated logic (e.g., (NY OR NJ) OR (CA OR TX) instead of ((NY OR NJ) OR (CA OR TX)) ).
- Using double OR instead of double AND (e.g., || instead of && ).
- Interpreting “or” as an exclusive OR (e.g., OR instead of OR ).
- Forgetting that “AND” and “OR” can take two or more arguments (e.g., (New York AND New Jersey) instead of (New York AND New Jersey) AND (California AND Texas)).
Query builders are one of the few places where it makes sense to have separate Basic and Advanced modes. You’ll probably find that 90% of your users’ queries fit only a few patterns. It makes sense to have these as canned or semi-canned queries that can be selected and specified easily while putting something like Kaleidoquery under Advanced for the rarer ad hoc querying.
In many cases, the advanced modes are just a user interface for query parameters, which you can get to through the Advanced menu of a query builder. In others, they provide a new way for a power user to get to a query. In some cases, they provide a way for a power user to get to a query that’s too complex for a user interface. If you decide to use query builders for advanced users, be sure to document how to use them.
Remember that query builders are one of the places where it makes sense to use an Advanced mode. If your power users have to hunt around for query parameters, the query builder will just become another tool that’s too hard to use.
Research on Kaleidoquery suggests some best practices for building boolean logic composers.
Examples of Good Boolean Logic UX
We have compiled a list of UI that users prefer.
Apple has a number of interfaces that they released to solve this problem:
Microsoft Access made a reasonable attempt at a simple database query UI by producing a visual version of “Query by Example”.
Drag and Drop Interface
This interface is well-tested with both technical and non-technical users:
Wizard or Stepper
The decision of choosing one interface over another also depends on the type of users you are dealing with. For non-technical users, a wizard with multiple steps might work better.
Instead of having it on multiple screens, you can also choose to reveal steps progressively:
We hope these examples gave you the inspiration to sketch your own Boolean logic interface. Let us know how you implemented yours in the comment section below.