It's all about the answers!

Ask a question

How do I query on a NOT condition?


Lewis Tsao (2174962) | asked Apr 07 '14, 2:04 a.m.

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



permanent link
Don Yang (7.7k21109138) | answered Apr 07 '14, 2:25 a.m.
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?
If that is the case, I don't think you will get the correct result because the approach should be in Eclipse client > custom attribute > check attribute usage in the repository and when you see the pop up, click on the synchronization, then you can query on the Task to find out which one has no value in the custom attribute(this is to show the workitems which are just synchronized with the new attribute but no value assigned yet). So in the query, you can set type to task and then select custom attribute and then
select "is" and check unassigned to get the list.
This is an example only. If my understanding on your use case is wrong, you may want to provide more details on what you mean by "here ATTR does not exist."


sam detweiler commented Apr 07 '14, 8:27 a.m. | edited Apr 07 '14, 8:28 a.m.

 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 


permanent link
Geoffrey Clemm (30.1k33035) | 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.

Your answer


Register or to post your answer.