Querying Work Items based on IWorkItemType
![]()
Hi,
I want to query the Work items based on certain work item types along with other conditions. Since more than one workitem types I want to check, I used AttributeOperation.MATCHES in the expression and it doesn't seem to work. At the same time, if I use AttributeOperation.EQUALS, it works. I understand matches operation internally does an equals operation on every object in the supplied Collection. Given below is the code snippet.
Please correct me if I'm wrong and help me out. Thanks and regards, Sethu |
2 answers
![]() // This doesn't return any workitems. MATCHES is the same as EQUALS and exists only for backward compatibility reasons. Your statement looks ok to me (although using EQUALS would be recommended). Alternatively, you can OR the different values explicitly: AttributeExpression defectExpression = new AttributeExpression(workItemTypeAttribute, AttributeOperation.EQUALS, "defect"); AttributeExpression taskExpression = new AttributeExpression(workItemTypeAttribute, AttributeOperation.EQUALS, "task"); Term term= new Term(Operator.OR); term.add(defectExpression); term.add(taskExpression); -- Regards, Patrick Jazz Work Item Team |
![]()
Thanks very much Patrick.
Since my workitem types are known only at run time, I'm creating and adding attribute expressions to an OR Term in a loop. It works. Regards, Sethu |
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.