Querying Work Items by their planned for / target (RTC Java API)
![]()
Liam White (1●1●1)
| asked Mar 06 '14, 10:26 a.m.
edited Mar 06 '14, 11:34 a.m. by Ralph Schoon (61.6k●3●36●43)
Hi,
I am trying to query work items that have a specific planned for / target but keep getting errors. I have tried the expression with both the name of the IIteration and the object itself (it's current state). Any help is much appreciated!
Here is my error currently:
com.ibm.team.repository.common.transport.ServiceMethodInvocationError: com.ibm.team.repository.common.query.QueryException: Unknown queryable field: target
and my code:
IWorkItemClient workItemClient = (IWorkItemClient) getTeamRepository().getClientLibrary(IWorkItemClient.class);
//Create a query factory
IQueryableAttributeFactory factory = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE);
IQueryableAttribute typeAttribute = factory.findAttribute(getProjectArea(), IWorkItem.TARGET_PROPERTY, getAuditableClient(), getMonitor());
//Begin writing our query expression
AttributeExpression typeExpression = new AttributeExpression(typeAttribute, AttributeOperation.CONTAINS, versions.get(14));
Term term= new Term(Operator.AND);
term.add(typeExpression);
//Execute query
IQueryClient queryClient = (IQueryClient) getTeamRepository().getClientLibrary(IQueryClient.class);
IQueryResult<IResolvedResult<IWorkItem>> result = queryClient.getResolvedExpressionResults(getProjectArea(), term, IWorkItem.FULL_PROFILE);
|
Comments
did u try the iteration id (the string behind the label)
like so?
HI White,
Hi Ramesh M,
I am also doing the same, trying to query work items that have a specific planned for.
Can you please share your solution if you have it already.
Thank you.
Regards,
Navin