Cannot get syntax to work

Ken Jacobs
Contributor
May 17, 2018

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

1 answer

1 accepted

0 votes
Answer accepted
Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 17, 2018

Hi @Ken Jacobs,

try this:

status not in (Done, Closed)

Ken Jacobs
Contributor
May 17, 2018

Thanks that worked! 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2018

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.

Ken Jacobs
Contributor
May 17, 2018

Seems backwards to me but thanks for the insight!

Ken Jacobs
Contributor
May 17, 2018

I thought the filer would see a status called "A" and a status called "B" and exclude both based on that alone. 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2018

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.

Ken Jacobs
Contributor
May 17, 2018

:)

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2018

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events