How to construct Expression for tags?
I am trying to construct a query thru Java API to fetch work items without any tags.
IQueryableAttribute tagsQAttribute = qAttributeFactory.findAttribute(projectArea, IWorkItem.TAGS_PROPERTY, auditableCommon, monitor);
Expression tagDoesNotContain = new AttributeExpression(tagsQAttribute, AttributeOperation.NOT_EQUALS, "");
I am struck in constructing 'Expression' for 'tag' attribute. I don't think my implementation is correct.
Can someone please help?
|
One answer
Ralph Schoon (63.5k●3●36●46)
| answered Dec 05 '19, 2:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
For all I can tell without actually trying, tags are treated as string. So you would use AttributeOperation.CONTAINS.
Not sure how multiple tags are represented for AttributeOperation.EQUALS. But the Equals usually does not make that much sense anyway, because there could be other tags than the one you are looking for, so contains and notcontains makes more sense.
Comments
MooR Rathinasamy
commented Dec 06 '19, 10:52 a.m.
No luck. I tried Expression tagDoesNotContain = new AttributeExpression(tagsQAttribute, AttributeOperation.NOT_CONTAINS, ""), but the query returned all WIs instead of WIs with tags. I also tried CONTAINING, NOT_CONTAINING. I tried to put null instead of empty string, but the API didn't like it.
In the Query editor, we form the condition as Tag 'is not' Unassigned. So i think we need to find a way to pass 'Unassigned'.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Related question - https://jazz.net/forum/questions/217961/query-rtc-work-items-with-a-certain-tag-programmatically