Show parent Issue's information when querying sub-tasks

Tianhao Li June 6, 2012

I want to use JQL to generate some report in the Issue Navigator page.

The requirement is I want to query from sub-tasks, but for each record of the sub-task, I aslo want to display some other information of the associated issue (parent).

e.g. 1. There are issues A, B, C;

2. Issue A includes sub-task a, b, c; Issue B includes sub-task d, e, f; Issue C includes g, h, i

3. given some conditions, a, b, c, d, e are the expected results show on the page, besides the information of sub-task, I also want to add information of its parent issue's (like, title, summary, etc)

Anyone knows how can I write the JQL which can satisfy my requirements?

I know a plugin called JQL Tricks plugin, but seems it can't do what i want.

Thanks

2 answers

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 6, 2012

First, you are confusing JQL and SQL slightly. We're all used to having SQL where you say "give me a list of data from the records matching my question", but JQL does NOT do that.

JQL only returns a list of issues. It doesn't display them or allow you to work with the data on the issues, it just gets a pointer to the issues to work with. There is a slight quirk of display in that it lets you define a sort order, but that's the only display thing it does. It also generates and holds some statistics (number of issues returned etc) to make reporting more simple.

It's then up to your display to work with that list of issues to get your data out in a useful format. The issue navigator for example, has a list of fields and it goes and looks up the data for each of the fields for the list it's given by JQL. Excel output does much the same. Gadgets like "filter statistics" take the list of fields and give you information about them without reading much data from the list of issues. And so on.

What I'm getting at here is that JQL is not the way to do this, and you're looking in the wrong place. JQL will give you the list of issues to work with, and the JQL tricks plugin can help you with more clever queries.

But for your display, you can't do anything like that because JQL is NOT what displays the information. The issue navigator is built as a simple grid display, and can't do the customised displays you want.

So, the answer is actually "Yes, you can write JQL to satisfy your requirements, but you're going to need to write code to display the results in the way you want".

0 votes
Verhás István
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.
June 6, 2012

JQL itself is not enough. JQL is only a query language that always select issues. It is like an SQL query that starts

select issue from jira where

and it could not be changed.

The issue navigator displays the result set of issues. It displays ANY field of the issue as it is configured. If you need any information of its parent issue's (like, title, summary, etc) then you need to develop and configure one or more customfields for this calculated values. The starting point is CalculatedCFType that can be extended by your plugin.

Verhás István
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.
June 7, 2012

The easiest way to do it let look at the groovy runner plugin's scripted field https://studio.plugins.atlassian.com/wiki/display/GRV/Scripted+Fields with a lot of working examples.

Suggest an answer

Log in or Sign up to answer