10

I have a pretty standard search form on a web site that will return records based on various criteria. Let's assume each record corresponds with a person. A person can have a dog, a car, neither, or both. There are two check boxes:

[A] Only people with dogs.
[B] Only people with cars.

Currently, these are ANDed. That is, if you leave both unchecked, you will get all records. If you check only A, then you'll only get records for people having dogs (they may or may not have cars). If you check only B, you'll only get records for people having cars (they may or may not have dogs). If you check both A+B, you'll only get records for people having cars AND having dogs.

Requirements are now dictating that users may want to search for people having dogs OR cars (or both), because checking both boxes will exclude people who only have one or the other.

Any advice on how to allow the AND and OR to coexist cleanly?

Should I go with radio buttons instead, and offer three choices?:

(A) People with dogs.
(B) People with cars.
(C) People with either dogs or cars.

EDIT: First, thank you all for the answers and comments; you've given me a lot to chew on. I apologize for the abstract example -- if it helps, this is health care system that allows you to pull up lists of patients to "work". The dogs and cars, in this example, correspond to alerts and reminders. An alert is something the patient should have had done but didn't. A reminder is something that the patient will need in the future.

The idea is that you can search for all patients with alerts, pull up each patient, and enter data to "satisfy" the alert (e.g., the patient had a blood test on 03/01/11 with a result of X). In addition, you can search for all patients with reminders, and enter data for those. You can choose both, and in doing so you will get patients that have BOTH alerts and reminders, but then you will be missing out on patients that only have one or the other. I wanted to abstract these in the example so that it was clear that the choices are conceptually different, but are interacted with in a similar fashion (i.e. they are both properties of the person, but they are not two types of the same thing like dogs and cats would be).

Here are my proposed reasons for each option (feel free to dispute any of these):

[*] Checking neither: You want all patients.

[A] Checking only "only people with alerts": You want to address patients with alerts because these are the highest priority. If a patient also has a reminder, that's fine; you may or may not address that reminder.

[B] Checking only "only people with reminders": You want to address patients with reminders because you want to build an appointment list, and/or enter data that would fulfill the reminder (e.g., the patient has a reminder for a blood test next month, but you already performed it yesterday, and here's the data).

[A AND B] Checking both: You want to address patients that have alerts and reminders so you can enter data if necessary, and also schedule appointments because the patients need some test done in the future.

[A OR B] (The New Requirement) Wanting to see patients with either alerts or reminders (or both): You want to see patients that require ANY type of attention or work.

[A XOR B] I don't see any reason for this, but I'm listing it for completion.

4
  • If you add any more criteria (e.g. dogs, cars, and children) you'll probably be better off with the more advanced solutions here: ui.stackexchange.com/questions/1737/… Mar 16, 2011 at 22:22
  • Glenn, thanks for the additional info. However, IMO it's not our job to find reasons to have this option or that. We can find reasons for pretty much everything, but this is something that needs to come from the field, from the users. We know nothing about it and can't really know what makes sense here, it's your job to get this input from the client. Mar 17, 2011 at 16:34
  • I totally agree, Vitaly. I added the extra information because more than one person commented that he/she didn't understand the goal of the question based on the example I gave. I'm not soliciting advice on the use cases, as that's not really a UI issue. The extra info was for clarification only. Mar 17, 2011 at 17:10
  • I guess my question comes down to: (1) Geert's suggestion to use 2 checkboxes and OR them, or (2) peterchen's suggestion to use 3 distinct radio buttons. Is one better or worse than the other? Mar 17, 2011 at 17:15

5 Answers 5

6

if you have only these three options

go with your last one - three distinct choices in a combo box or radio buttons.

( ) people with dogs ( ) people with cars ( ) people with either dogs or cars

For more options, there are various solutions with different functionality/complexity tradeoff:

'All of the above'

People with
[ ] dogs
[ ] cars
[ ] lasersharks
[ ] all of the above

This basically allows the user to switch between "OR" and "AND" for all options selected. "All of the above" should get some visual distance. It could also be replaced by radio buttons:

People with
( ) any ( ) all of
[ ] dogs
[ ] cars
[ ] lasersharks

This would allow different selectors (such as "only one of"), but appears a bit more complictaed to me

Filter Bar for progressive reduction

If you can display all results (i.e. it's not a bandwidth / server issue), you can provide show all data first, then add filter options, e.g. something like that:

enter image description here

Which would e.g. AND the restrictions from each column, and OR the options per column. For column lice Accessories, the values can be derived from a SELECT DISTINCT query, a column like age ist best handled by allowing to pick a row and to specify ""older than / younger than this".

Query Builders

Free query builders, as mentioned before, will give full flexibility - yet I've seen none that wouldn't scare most casual users. They are a good "advanced" option, asking for some easier UI for common queries, and a method to store and recall previously configured queries.

1
  • I concur with your second example. No need for the extra radio buttons, just A, B, C and 'All'. It's the simplest to understand and should therefore get the highest conversion. (Ensuring that by selecting 'All' the other 3 are automatically set as checked)
    – JonW
    May 16, 2011 at 10:05
5

There are 4 groups really:
[ ] People with dogs, but not cars
[ ] People with cars, but not dogs
[ ] People with both dogs and cars
[ ] People with neither a dog nor a car

Its hard to guess what the user is actually looking for by only looking at the dog and car example.

The 2 checkbox approach should probably work using an OR
A) People with dogs
B) People with cars
These 2 options using OR will give you:
- when only A is checked, people with dogs
- when only B is checked, people with cars
- when both A and B are checked, people with dogs or cars
- when neither is checked, all people

Question is whether you really need to know whether people have a dog AND a car.

I would suggest to also have a closer look at faceted search.

2
  • 1
    Yes, there are four groups and each person belongs to exactly one of those groups. I was confused by your list at first. I rephrased it a bit so it's clearer (to me). I hope you don't mind. If so, you can roll back the change. Mar 16, 2011 at 22:21
  • If it is clearer now, now worries at all :)
    – Geert
    Mar 17, 2011 at 8:30
5

I think that you just need to explicitly show for each criterion whether it's part of the query or not:

enter image description here

This way, the user has no doubts as to whether searching for "people with dogs" will also include people who have both dogs and cars.

EDIT

Thanks to @Jeff for pointing out the problem with this. It should actually look like this, to allow the selection of people with dogs regardless of whether they also have a car:

enter image description here

4
  • Is it possible to select neither yes or no for 'People with Dogs'? If not, that doesn't address the problem.
    – JeffO
    Mar 18, 2011 at 20:16
  • @Jeff, you're right, I updated the sketch. Thanks! Mar 18, 2011 at 23:22
  • 1
    Hey, that's pretty cool! I think the combination of checkbox and radio is a little confusing, though. Having three radio buttons might work better. (Yes / No / Doesn't matter) Mar 19, 2011 at 1:01
  • @Patrick I think that if I had sketched one of the lines with an unselected checkbox, and its controls disabled, it would've been much clearer visually. But I think you're right and a third radio button is better. I do think it doesn't scale as well as what I sketched, but as long as there are very few parameters, it's probably clearer. Mar 19, 2011 at 8:03
4

What about putting a dropdown above the checkboxes where the user selects what kind of search to try - looking for ALL the criteria (and) or ANY of the criteria (or):

enter image description here

4
  • This way seems the cleanest (especially when you have more than 2 options) but I use something like this on my site and people tend to not notice it or not understand what options it gives them: skitch.ravelry.com/skitched-20110316-204332.png
    – outcassed
    Mar 17, 2011 at 0:44
  • 2
    Yep, this would work and I tend to agree with Bevan's statement that users are often confused with the result ANY vs OR will actually give them. This takes me back to question whether you really need to be able to drill down to only those people with "Dogs AND Cars", because this is the requirement causing the 2 check box solution to be insufficient? Its a bit like looking for a piece of clothing on eBay and wanting to see "only" those items which are both in the Woman's Clothing AND Men's Clothing section ... then again, we don't know what in your case the Dogs and Cars represent :)
    – Geert
    Mar 17, 2011 at 8:23
  • If anything this is more confusing than the alternatives … Mar 17, 2011 at 12:41
  • @Geert +1 - Even I am confused, and have been, several times, trying to decipher the real goal of this question. I agree, the OP should look back and see if they actually need both AND and OR.
    – Nicole
    Mar 17, 2011 at 14:19
0

The latest - three radio buttons.

Using checkbox when choices are alternative is wrong.

I would also be more specific:

(A) Only people with dogs.

(B) Only people with cars.

(C) People with either dogs or cars.

1
  • 1
    I agree. But I'm not really sure how your options are more specific than what @Glenn had in his question though. Mar 16, 2011 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.