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

Programaticaly How to get list of Work Items for a specific time period?

Hi All

I have  TASKS created between a specific time period say between Apr 14, 2014 to Apr 18 , 2014.

Programaticaly how to get list of Work Items for this specific time period?

Regards
Niranjan V

0 votes


Accepted answer

Permanent link
Probably, the most easy way is to use Reports restAPI.

 https://jazz.net/wiki/bin/view/Main/ReportsRESTAPI#Resources_provided_by_RTC

For example, in you case:

https://<your-server>:9443/ccm/rpt/repository/workitem?fields=workitem/workItem[creationDate > 2014-4-14T10:10:53.000-0900 and  creationDate < 2014-4-18T10:10:53.000-0900](id|summary)


V Niranjan selected this answer as the correct answer

0 votes


One other answer

Permanent link
You can also do it using the Java APIs although you have to build the SQL yourself.  For example:

Term itemsToQuery = new Term(Operator.AND); //AND all my things together
IQueryableAttributeFactory factory = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE);
IQueryableAttribute createDateAttribute = factory.findAttribute(myProjectArea, (IWorkItem.CREATION_DATE_PROPERTY), auditableClient, monitor);
Timestamp t = new Timestamp(2014 - 1900, 3, 22, 23, 59, 0, 0); //4/22/2014 00:00 - 4/22/2014 23:59
AttributeExpression startDateExpression = new AttributeExpression(creationDateAttribute,
                                                                          AttributeOperation.AFTER,
                                                                          t);
itemsToQuery.add(startDateExpression);

Then do the same thing with another Timestamp for the date you want and do a endDateExpress with the same creationDateAttribute, AttributeOperation.BEFORE, and the other Timestamp.

Then create a statement:
Statement s = new Statement(new SelectClause(), itemsToQuery, new SortCriteria[] { sortByIdSortCriteria }); //sortByIdSortCriteria is a SortCriteria object

And then the query uses the queryClient:
            IQueryResult<IResolvedResult<IWorkItem>> results = null;
            results = queryClient.getResolvedExpressionResults(myProjectArea, s, IWorkItem.FULL_PROFILE);

Then you can do results.next().getItem() to get the matchingWorkItems.





        Timestamp tt = new Timestamp(2014 - 1900, 3, 28, 0, 0, 0, 0); //4/22/2014 00:00 - 4/22/2014 23:59
        AttributeExpression endDateExpression = new AttributeExpression(creationDateAttribute,
                                                                        AttributeOperation.BEFORE,
                                                                        tt);
        newItemsToBridgeToJava.add(startDateExpression);

        /* Sort by id */
        SortCriteria byId = new SortCriteria(wasRepo.findQueryableAttribute(IWorkItem.ID_PROPERTY), true);

        /* Create statement */
        Statement s = new Statement(new SelectClause(), newItemsToBridgeToJava, new SortCriteria[] { byId });


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
× 12,016

Question asked: Apr 21 '14, 10:43 p.m.

Question was seen: 4,145 times

Last updated: May 02 '14, 3:39 a.m.

Confirmation Cancel Confirm