How to use nested subquery to search issues

Avinash Londhe December 16, 2018

Board1: Level1_Query: Display specific set of initiatives (not all)

Project = "xyz" AND Type = "Initiative" AND Labels in (A01, B01,C01,D01)

Board 2: Level2_Query:  Display Epics for above set of initiatives linked by "Parent Link"

Project = "xyz" AND Type = "Epic" AND IssueKey In (Level1_Query)

Complete Query:  Project = "xyz" AND Type = "Epic" AND IssueKey In ('Project = "xyz" AND Type = "Initiative" AND Labels in (A01, B01,C01,D01)')

Board 3: Level3_Query: Display Epic and their next level children;stories/tasks (Not the Sub-Tasks)

Project = "xyz" AND Type NOT IN ("Initiative") AND IssueOfEpics (Level2_Query)

Board 4: Level4_Query: Display Stories/Tasks from level 3 with their sub tasks

Project = "xyz" AND Type NOT IN ("Initiative","Epic") AND IssueOfEpics (Level3_Query

----

Basically I want to implement nested queries in filter criteria. Any help would be appreciated.

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Alexey Matveev
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.
December 16, 2018

Hello,

I am not sure from which plugin you have the IssueOfEpics function, but you could use filters as nested queries.

You could create a filter and then use it in JQL query like this:

filter = <your filter id>
Avinash Londhe December 16, 2018

ok let me give it a try

Avinash Londhe December 16, 2018

IssueOf Epics is just some text. Was trying to explain what I am trying to achieve.

Avinash Londhe December 16, 2018

Can you give me example for below:

 

This is what I am trying to achieve…

Board1_Initiatives_Query: Display specific set of initiatives (not all)

e.g. Project = "xyz" AND Type = "Initiative" AND Labels in (A01, B01,C01,D01) ‘---OK no Issues

Board2_Epics_Query:  Display Epics (only) for above set of initiatives linked by "Parent Link"

e.g. Project = "xyz" AND Type = "Epic" AND status In (“Open”,”In-Dev”,”In-QA”) AND issue in issuesParents (Board1_Initiatives_Query)

Board3_Ticket_Query: Display Epic and their next level; stories/tasks/defects (Not the Sub-Tasks) for above set of epics

e.g. Project = "xyz" AND Type NOT IN ("Initiative",”Sub-Tasks”) AND issueFunction in issuesInEpics(Board 2_Epics_Query)

And so on…

Like bjamesd likes this
Alexey Matveev
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.
December 17, 2018

Jira does not have such function as issuesParents or IssuesInEpic. You would need an add-on to have this functionality.

For example, you could use the Power Scripts.

https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation?hosting=cloud&tab=overview

Power Scripts have inbuilt functions needed by you:

https://confluence.cprime.io/display/JJUPIN/Pre-defined+JQL+functions

Avinash Londhe December 19, 2018

Thanks

Alexey Matveev
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.
December 19, 2018

You are most welcome!

Sonny Myet August 15, 2019

Does using a saved filter in another filter effect the search performance? 

4 votes
Helga Tryggvadóttir October 4, 2021

I know it's been a while since Avinash posted this question, but I was searching for a similar solution recently and I came across this available function in Jira cloud: 

issuekey in portfolioChildIssuesOf(Initiative-1)

 This gives all Epics, Tasks etc for Initiative "Initiative-1".

1 vote
Bari Nuhiji September 17, 2019

Hi,

I have been successful with . Jira query to get all the stories for a given set of 'Features' associated with a parent Epic.

Note that we have not created a parent 'Initiative', but simply associated a parent Epic to Child Epics 'Is Implemented By' relationship'.

 

ie.

  1. DES-001 (parent epic)
  2. DES-002 (child epic) - "Feature" Is Implemented By
  3. DES-003 (story) - associated with DES-002

 

The query to give me the list of all stories under DES-001 is:

issueLink in (linkedIssues(DES-001)) AND Type = Story ORDER BY "Epic Link"

The ORDER BY provides a visual grouping of stories per Epic (level 2).

 

The output would be DES-003 only. But if you had 50 level 2 epics, then it would return all the stories associated with Level 2 'Features' (of type Epic). Simply labelling the level 2 Epics as 'Features' would provide a way of tracking them accordingly.

 

Cheers.

0 votes
Murali G October 15, 2019

While running the following query i.e issueFunction not in issuesInEpics("Clarity Project= P000000290 ABC XYZ 2.0")

getting the below error

  • Error in the JQL Query: Expecting operator but got 'Project'. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 9)

some one can help me like how to override the spaces in subqueires?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question