How do I query on a NOT condition?
Sometimes I need to query for work items that does not have a particular attribute. So for (very bad) example, I want query for all work items where "Story Points" attribute does not exist. I may also want to query on NOT (and group) for exampe. Is it possible to query on NOT condition? If not, does it make sense to raise an enhancement request on this?
|
2 answers
Surely NOT condition is achievable and existing in the Query condition.
Please see this article for more details: https://jazz.net/library/article/1007 Unless you have any specific use case and no way to achieve that in the existing query conditions(may not directly use NOT condition though), I don't think raising a RFE would help to move forward as the requirement is not clear at all at this moment. If you do have specific use case, you may want to put the details in forum and see if there is any alternative way someone may suggest. Comments
Lewis Tsao
commented Apr 07 '14, 2:29 a.m.
A specific use case can be when I create new customer attributes, ATTR say, for a specific work item type, Task say. I would want to query for all Tasks where ATTR does not exist. Currently it is only possible to query for Tasks where ATTR exists.
Don Yang
commented Apr 07 '14, 3:00 a.m.
Do you mean that you created a new custom attribute and some workitems were created before that and you want to find out what workitems are not having that custom attribute so that you can sync all of them?
Lewis,
why does the built in synchronization not work? (just asking).
many times when I want to do something, I have to read the product source code (shipped in the SDK) to find out how the product does it.
Shift+Alt+F1 in eclipse will tell you plugin and class involved, you can import the plugin as source from the plugins view..
in this case the plugin-spy info looks like this
|
Geoffrey Clemm (30.1k●3●30●35)
| answered Apr 07 '14, 3:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
There are some terms that explicitly allow you to say "NOT xxx" in the query term, but there is no generic NOT operator. It has been requested in work item Add "AND Not" to query sets for "false" boolean operator. (178802). Please feel free to add a comment to indicate your interest/support.
Comments
Don Yang
commented Apr 07 '14, 8:12 a.m.
Thanks Geoff. I did not realize NOT operator is not there. Even though we may be able to achieve something similar with the existing operators for most queries, if NOT operator is provided, it would make things simple for some use cases.
|