Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JQL - Writing AND statements that require another nested AND?

I have a custom filter written in JQL with several consecutive AND statements combined with != due to the required field to search does not support list use like (A,B,C).

I need to add another AND condition but that condition must also contain another AND operator. Something like:

... AND (component != R AND type != S) AND...

The above is for reference to what I'm trying and is not valid JQL.

Is this possible?

1 answer

1 accepted

2 votes
Answer accepted

Can you post the whole JQL? Nested segments and all. Feel free to obscure field names/values.

Also is there more to the error for invalid JQL?

status = Open AND component in ("A", "B", "C", "D", "E", "F", "G", "H", "I") AND cf[11802] != CUSTOMER1 AND cf[11802] != " CUSTOMER2" AND cf[11802] != " CUSTOMER3" AND cf[11802] != " CUSTOMER4" AND cf[11802] != " CUSTOMER5" AND cf[11802] != " CUSTOMER6" AND cf[11802] != " CUSTOMER7" AND cf[11802] != " CUSTOMER8" AND cf[11802] != " CUSTOMER9" AND cf[11802] != " CUSTOMER10" AND cf[11802] != " CUSTOMER11" AND cf[11802] != " CUSTOMER12" AND cf[11802] != " CUSTOMER13" ORDER BY created DESC, key DESC

 

I need to add an “AND not equal” for something that will look at cf[11802] AND another custom filed for TYPE of certain criteria and not display those.

The error you recieve when trying to do "cf[11802] != (A,B,C,D,etc.) is that the field does not support list values.

What type of custom field is it for this part:
cf[11802] != (A,B,C,D,etc.)

You might be need the Not In () operator if you're using a select field or similar and want to exclude several options. 

it is a Select List (Single Choice) Field of Global Type

as note, the second custom field I'm looking to combine with "Customer14" is also a Select List (Single Choice) Field of Global Type

was that the right answer?

Also, I only want to address the second field (which does appear on all other tickets) for Customer 14.  If I try to add another operator for the second custom field, it eliminates ones for customers I want to see.

So could you accomplish this using:

(cf[11802] not in ("Customer1", "Customer2", "Customer3", ....) and status = Open AND component in ("A", "B", "C", "D", "E", "F", "G", "H", "I")) OR (cf[11902] = "Customer14" and cf[99999] = "abcdef")  order by created desc, key desc

It was pretty close, I added an AND status = OPEN statement to the CUSTOMER14 section after the OR statement, and that reduced the display a bit as well.

Also, I made sure to include the CUSTOMER14 name in the first statement for "not equals", then also used CUSTOMER14 after the OR statement to say to include that customer name with the AND for priority, and it worked!

THANK YOU SO MUCH!!!!!

Happy to help 😀

Here is the final JQL:

cf[11802] not in (CUSTOMER1, CUSTOMER2, CUSTOMER3, CUSTOMER4, CUSTOMER5, CUSTOMER6, CUSTOMER7, CUSTOMER8, CUSTOMER9, CUSTOMER10, CUSTOMER11, CUSTOMER12, CUSTOMER13, CUSTOMER14) AND status = Open AND component in(A, B, C, D, E, F, G, H, I) OR cf[11802] = CUSTOMER 14 AND priority = “P1” AND status = Open ORDER BY created DESC, key DESC

"hi5"

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,881 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you