How to search based on single entry of Component

L Grove January 12, 2012

When doing a simple JIRA query, I want to find all the bugs that are only attributed to one specific component. But when I use EQUALS, it returns results that are IN.

For example, when the search string is "Project = X AND component = Component_1 AND status = sx ..." I get the bugs that are associated with Component_1 and other components. This is acting like the IN function.

What I want is bugs that are associated only with Component_1

4 answers

2 votes
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.
January 12, 2012

Mmm, that's a pretty obscure query - it's not often people would ask for "only that component". Why are things with that component AND other components not important? Surely if component X is breaking system Y, you want the people who own it to fix it for Y as well as X?

Also, you say "... and X and y and z..." is acting like an IN function. That's wrong, try it again, it's not an "in"

Anyway, because it's an unusual question to ask, I don't think it's available directly. I think your best bet for "only component_1" is going to be "component = component_1 and component NOT IN (component_2, component_3, etc". I don't think it's a particularly useful query for your humans, because they really won't care whether it's only got one component, but that's the best I think you can do.

L Grove January 12, 2012

We have different people working on different components.

I will edit the question a bit as I wasn't saying "and X and y and z"

Benjamin Peikes May 20, 2021

It's not that obscure. We have Story tickets which we list all of the components needed to implement, some of which haven't been spec'd down to the specific implementation details.

If we have resources available to work on a specific component, sometimes we want to know which items we can work on. i.e. UserA only works on component B, so we want to list all open issues that are only component B, and don't rely on any other components.

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.
May 20, 2021

But if something needs work on it because of component A, what does it matter that it also has components B and C?  In fact, searching for "A but not B or C" would mean that your A-developer is going to be missing work they need to do.

0 votes
Raphael Negri February 13, 2019

with Adaptavist ScriptRunner ...component in (component1) and component not in componentMatch("[^component2")... works for us fine.

0 votes
Graham Wright August 8, 2018

Same issue here.

We have a custom field which is multi-select called 'client'.  The client field allows us to specify one or more clients that an issue impacts.

I need to be able to raise a report on issues that only impact a particular customer.  We have hundreds of clients and the list evolves frequently, so it is not feasible to solve the problem based on 'labels in (X) and labels not in (Total - X)'.

0 votes
Rene Rath July 3, 2014

Similar problem over here.

Our scenario: we have a team which works on a pretty separate component. We do have tickets, which involve this component among other components. There are fine, our product managers do want to see them. But that team also uses that very jira instance and project for tickets, which only affect that single team/component and nothing else. THOSE tickets are only confusing for our product managers and I would like to define a quick filter for the agile board in order to sort them out.

So I want to filter out all tickets, which have ONLY that component and NO OTHER component. Sure, I could proceed as Nic pointed out, but I would have to edit that filter every time a new component comes along.

Something like this would be good

component != "MyComponent" AND NOT component in (NOT "MyComponent")

but (NOT "MyComponent") is not correct JQL.

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.
July 3, 2014

Ah, I have a trick for that one.

If you have the script runner addon, or can write an addon, you can write a new derived field (field with data built from other data on an issue). If that field is a simple number field of "component_count", then you can filter for "Component = myComponent and component_count = 1"

Rene Rath July 3, 2014

Billiant news. I do have Jamie Echlin's script runner plugin installed (big fan of it). But so far, I haven't created a scripted field yet. I did now but don't know what to put into the inline script field. I'm not familiar with groovy syntax. Can I bother you to paste the appropriate code here? ahem. ;-)

Rene Rath July 3, 2014

No worries, found it myself!

return issue?.componentObjects?.size() as String

(found on https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fields)

Cheers!

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.
July 3, 2014

Make sure you create the field with a numeric searcher and a number template, then you should be able to just use

return issue.getComponentObjects().size() ;

as the script (Untested, and from memory, but I think it works)

Rene Rath July 3, 2014

Searcher: Number Searcher

Template: Number Field

Inline script: return issue?.componentObjects?.size() as Double

And in the screen, the preview test looks great: I entered the issuekey of a ticket with 3 components and that preview ideed returned "3". Almost there!

But JQL behaves odd:

when I start typing "ComponentCount" (that's what I've called that field), the autocompletion suggests "~", "!~", "is not" and "is". It does not suggest "=" or "<" and such numeric operators. And when I write "ComponentCount = 3", I don't get an error message (which I would expect after those auto completion suggestions), but I simply get an empty result set. I expected to get at least that single issue, for which I've performed the preview test.

Any ideas?

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.
July 3, 2014

Have you got the searcher set correctly as a number range searcher?

Rene Rath July 3, 2014

cheers, mate! that did the trick. Was a Number Search field and not a number range field. now it works!

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.
July 3, 2014

Yes, sorry, I said "numeric searcher" which is pretty much useless because it doens't tell you which search to use!

Suggest an answer

Log in or Sign up to answer