How to get 1000+ (all) workitems of project area ?
- the project area has 1000+ work items
- following code returns me work item of the project area, however it stops at 1000 count.
How do I get all the work item of project area ?
- following code returns me work item of the project area, however it stops at 1000 count.
How do I get all the work item of project area ?
private static IQueryResult<IResolvedResult<IWorkItem>> queryForWI(String tag, ITeamRepository teamRepository, String projectAreaName)
throws TeamRepositoryException {
IProcessClientService processClient= (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class);
IQueryClient queryClient= (IQueryClient) teamRepository.getClientLibrary(IQueryClient.class);
//IAuditableClient auditableClient= (IAuditableClient) teamRepository.getClientLibrary(IAuditableClient.class);
URI uri= URI.create(projectAreaName.replaceAll(" ", "%20"));
IProjectArea projectArea= (IProjectArea) processClient.findProcessArea(uri, null, null);
if (projectArea == null) {
throw new ItemNotFoundException(NLS.bind("Project area {0} not found", projectAreaName));
}
Term term= new Term(Operator.AND);
SortCriteria[] sortCriteria= new SortCriteria[] { new SortCriteria(IWorkItem.ID_PROPERTY, true) };
Statement statement = new Statement(new SelectClause(), (Expression) term, sortCriteria);
return queryClient.getResolvedExpressionResults(projectArea, (Expression) term, IWorkItem.FULL_PROFILE);
}
7 answers
I can't tell you how to get all the work items from a query, but it is controlled by a property on the server. From the server admin web page, select "Advanced Properties" and search for 1000. You will eventually come to the property for max query result size (it is "Maximum Query Result Set Size" in 3.0). The tool tip seems to indicate that the result set size could be set for the individual query itself.
- the project area has 1000+ work items
- following code returns me work item of the project area, however it stops at 1000 count.
How do I get all the work item of project area ?
- the project area has 1000+ work items
- following code returns me work item of the project area, however it
stops at 1000 count.
How do I get all the work item of project area ?
You can set the limit for a query on IQueryResult (before iterating over
the results):
Instead of
return queryClient.getResolvedExpressionResults(projectArea,
(Expression) term, IWorkItem.FULL_PROFILE);
You could write
IQueryResult result= queryClient.getResolvedExpressionResults(projectArea,
(Expression) term, IWorkItem.FULL_PROFILE);
result.setLimit(5000);
return result;
--
Regards,
Patrick
RTC Work Item Component Lead
I can't tell you how to get all the work items from a query, but it is controlled by a property on the server. From the server admin web page, select "Advanced Properties" and search for 1000. You will eventually come to the property for max query result size (it is "Maximum Query Result Set Size" in 3.0). The tool tip seems to indicate that the result set size could be set for the individual query itself.
Having updated the property, there is no effect.
Does this require a server side reboot?
- the project area has 1000+ work items
- following code returns me work item of the project area, however it
stops at 1000 count.
How do I get all the work item of project area ?
You can set the limit for a query on IQueryResult (before iterating over
the results):
Instead of
return queryClient.getResolvedExpressionResults(projectArea,
(Expression) term, IWorkItem.FULL_PROFILE);
You could write
IQueryResult result= queryClient.getResolvedExpressionResults(projectArea,
(Expression) term, IWorkItem.FULL_PROFILE);
result.setLimit(5000);
return result;
--
Regards,
Patrick
RTC Work Item Component Lead
Hi Patrick,
Picking up on this old thread. I'm trying to do this with v2 of the API and it doesn't seem to be working. Is there something I have to do to iterate other than:
result.setLimit(totalSize);
for (int i = 1; result.hasNext(null); i++) {
where
Thanks,
Tim
Hi,
I had to make sure to use
results.setLimit(Integer.MAX_VALUE-1); // First thing to do!!!!!!
as the very first thing to do with the resultset. I assume later the iterators are already set up with a linit and that does not change anymore.
Thanks. Not sure what I was doing wrong -- I definitely wasn't iterating before I set the limit -- but setting it immediately after getting it seems to have done the trick.
Best,
Tim