I have two statuses I want to exclude from a filter: Closed or Done. Am I doing something wrong with the OR statement? The syntax below excludes Done but not Closed:
status != Done OR status != Closed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For what it's worth,
status != Done OR status != Closed
does not work because it's logically wrong.
If an issue is Done, it can't be Closed, so clause 2 returns true, and if it's Closed, it can't be done, so clause 1 returns true. As one clause is always true and you've used OR, you are always going to get a true result.
You needed to use AND, rather than OR, but Thomas' way of writing it is a lot more clear and easier to modify.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I thought the filer would see a status called "A" and a status called "B" and exclude both based on that alone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Humans are often bad at logic, with their instincts leading them astray, especially when there are negatives in something. "Is this a tiger?" is an easier question to us than "is this not a small cat?" - the "not" causes us to have to do a lot more work to get the right answer.
I found the trick is to look at each clause individually when something doesn't work, then bolt them together one at a time to re-form the question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I should add that I learned this "humans are bad at logic" first hand, when stuffing up the first big development project I was supposed to be the main coder on.
20 years later, I still have to step back and think "remember, you're not Viz's Mr Logic, your instincts here could be wrong". For me, it's especially on searches and nested ifs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.