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
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
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'.
Comments
MooR Rathinasamy
Dec 06 '19, 11:05 a.m.Related question - https://jazz.net/forum/questions/217961/query-rtc-work-items-with-a-certain-tag-programmatically