Is it possible to return list of issues where component count = x?

I have a list of issues that are connected to spesific components. Most are connected to several components, and sometimes the connection is wrong. Before changing or removing the component link, I need to know if the issues will still have a component connection if I remove a spesific connection. 

So what I need is someting like this: 

Project = xxx And Issuetype = xxx and component = xxx and Component.Count = 1.

 

Is this in any way possible with JQL?

1 answer

This widget could not be displayed.

Hi Ole,

It isn't possible to do this by default in JIRA using JQL, but you can do this by running the following query in your database:

SELECT p.pkey, ji.issuenum FROM component c
    JOIN nodeassociation na ON na.sink_node_id = c.id
    JOIN jiraissue ji ON ji.id = na.source_node_id
    JOIN project p on p.id = ji.project
    JOIN issuetype it ON it.id = ji.issuetype
WHERE na.sink_node_entity = 'Component'
    AND na.source_node_entity = 'Issue'
    AND c.cname IN ('COMP-NAME')
    AND p.pkey = 'PROJECT-KEY'
    AND it.pname = 'ISSUE-TYPE'
    AND ji.id IN 
        (SELECT ji.id FROM component c
            JOIN nodeassociation na ON na.sink_node_id = c.id
            JOIN jiraissue ji ON ji.id = na.source_node_id
            JOIN project p on p.id = ji.project
        WHERE na.sink_node_entity = 'Component'
            AND na.source_node_entity = 'Issue'
        GROUP BY ji.id
        HAVING count(c.id) > X)
ORDER BY 2;

You just need to replace:

  • 'COMP-NAME' with the actual name of the component
  • PROJECT-KEY with the key of the project
  • 'ISSUE-TYPE' with the name of the issue type and 
  • X with the number of components

I know this is a big query, but I hope it helps. smile

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

52 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you