How can we write a jql query to find all the child issues for a structure whose custom field named area(example) matches with the custom field named area of the parent issue?
i have the following structure query to get all the child issues for a given parent issue. But how to add the extra part in the query to retrieve only those issues which are having the same value for a particular custom field like its parent?
issue in structure(Hierarchy, "descendant of PROJ-980")
if PROJ-980
has area X
, you can say
issue in structure(Hierarchy, "descendant of PROJ-980 and [area = X]")
Note, however, that in either S-JQL or in JQL you cannot express constrains on issues based on field values of other issues; you always need to name values directly. When designing S-JQL, we thought about including such constraints, but we decided not to because we lacked evidence that someone will need it. So far this is the first request of this kind.
As a workaround, if the field can have one of a few values, you can enumerate these values. For example, suppose that field area
can only have three values: X, Y
and Z
; then you say
issue in structure(Hierarchy, "[area = X] and descendant of [area = X] OR
[area = Y] and descendant of [area = Y] OR
[area = Z] and descendant of [area = Z]")
In case you need to find all descendants whose area > parents area, again, you'll need to name parent values directly:
issue in structure(Hierarchy, "[area > X] and descendant of [area = X] OR
[area > Y] and descendant of [area = Y] OR
[area > Z] and descendant of [area = Z]")
Edit: I've created a request in our JIRA for extending S-JQL to allow the mentioned constraints.
Thanks Igor that was very helpful. To add to the above query can we also perform search like this
in case i have a parent issue in structure of type "parent" and there are 4 subissues/descendants under it of type "sub" . Each of these issues have some area defined. i need to search all the subissues/descendants whose area is greater than parent's area
so something like " find all descendants whose area > parents area"
Can we search in the existing S-JQL?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can understand from your comments "Note, however, that in either S-JQL or in JQL you cannot express constrains on issues based on field values of other issues; you always need to name values directly" but in case if we need to incorporate such criteria how can we do that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Again, you'll need to name the parent's area directly. So, if field {{area}} can only have values {{X, Y}} and {{Z}}, you'll need to do this: issue in structure(Hierarchy, "[area > X] and descendant of [area = X] OR [area > Y] and descendant of [area = Y] OR [area > Z] and descendant of [area = Z]")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Igor . Thanks a ton. That helped me. I have created few issues assigned the area and some of these issues are descendants of issue1 (descendant1,descendant2) and issue2 (descendant3,descendant4). Both issue1 and issue2 has area 10. So my query is: issue in structure("structure - 1" , " [area>10] and descendant of [area=10] ") So in case all these descendants have area > 10 , all the issues will be pulled out since both the parent issue had area 10. But if i want to restrict it to only one parent: issue in structure("structure - 1" , " [area>10] and descendant of [area=10] ") and and issue in structure(" structure - 1 ", "descendant of TESTNEW-785") This would work. But is there a better way of doing this.(restricting to some particular parent)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure — you just need to substitute area constraint to issue key constraint: issue in structure("structure - 1", "[area > 10] and descendant of TESTNEW-785")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Igor :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.