Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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 ?




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);
}

0 votes



7 answers

Permanent link
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.

1 vote


Permanent link
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 ?

0 votes


Permanent link
- 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

0 votes


Permanent link
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?

0 votes


Permanent link
Having updated the property, there is no effect. Does this require a server side reboot?


I have the same problem. Were you able to get this resolved?

0 votes


Permanent link
- 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 totalSize is the total number of workitems?

Thanks,
Tim

0 votes


Permanent link
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

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,952

Question asked: Nov 09 '10, 10:51 a.m.

Question was seen: 11,088 times

Last updated: Nov 13 '12, 11:10 a.m.

Confirmation Cancel Confirm