Exclude items from a filter based on the output of another filter

Yannick Fauconnier February 24, 2016

Hi

I am looking for several days how to exclude the results from a first filter in a second filter.

So basically, I have 2 projects. One is for our support, the second one is for our development. 

Every time our customer creates a support ticket who implies a development, we create a development ticket and fill a field "Customer ID" pointing to the support ticket.

Now when I search for :

  • project = "DEV_PROJ" AND status not in ( Closed ,resolved,Rejected)
  • project = "SUPPORT_PROJ" AND status not in ( Closed ,resolved,Rejected)

Both queries give the list of open tickets. Now if I link them with an AND, I get one big list. That's nice.

But my problem is the following:

In the first query result, I have the field "Customer ID" who has the ID from the support ticket, so thought that I would in the second query just do something like:

  •  project = "SUPPORT_PROJ" AND status not in ( Closed ,resolved,Rejected) AND key not in (the Customer ID field from the first query result)

Trying for several day but can't manage to get.

Any ideas or suggestions ?

 

 

3 answers

7 votes
Georges Moubarak
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.
February 24, 2016

Hi @Yannick Fauconnier,

 

I suggest to link the requests together instead of using a custom field to reference the support ticket.

If you do so, you can build a query to exclude tickets that have links to Dev project.

1 vote
MattS
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.
February 25, 2016

There are performance risks but you might be able to  use the JQL "filter" keyword to do this. Not tested but:

Saved as filterA: key not in (the Customer ID field from the first query result)

Then a new filter using the filter keyworkd:

project = "SUPPORT_PROJ" AND status not in ( Closed ,resolved,Rejected) AND filter not in filterA

Marco Scheidegger May 22, 2018

I had a similar problem: substructing issue listB from issue listA and using filter works.

filterB: jqlB

jqlA AND filter NOT IN (filterB)

Like Shel Price likes this
0 votes
Udo Brand
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.
February 24, 2016

in the out of the box JQL you can't do it, since you can't compare two fields (and that is what you are trying to achieve).

Maybe you can do it with Scriptrunner having some powerful JQL function like "expression". See: https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_expression

Note: it will only work when your Key or "Custoner ID" are numeric fields .

Yannick Fauconnier February 24, 2016

Yeah unfortunately, Key is like DEV-001 and SUP-001 

Suggest an answer

Log in or Sign up to answer