It's all about the answers!

Ask a question

Querying for sorted list of "unresolved" work item


Samit Mehta (31103) | asked Mar 10 '09, 6:43 p.m.
JAZZ DEVELOPER
The RTC SDK article "Developer's Guide to Querying Work Items" provides most of the information necessary to query and view results. Is there a way to do the following programmatically:
- Query for "unresolved" work items. The Query Editor allows you to specify that the "Status" attribute is "unresolved" and/or "resolved"
- Sort the result set

4 answers



permanent link
Huan Feng Cai (11) | answered Jun 18 '15, 4:32 a.m.
results = queryClient.getResolvedExpressionResults(projectArea, (Expression) queryRefgterm, IWorkItem.FULL_PROFILE);

results = queryClient.getResolvedExpressionResults(projectArea, statement, IWorkItem.FULL_PROFILE);

--
Regards,
Huanfeng,Cai

permanent link
Huan Feng Cai (11) | answered Jun 18 '15, 4:28 a.m.
results = queryClient.getResolvedExpressionResults(projectArea, (Expression) queryRefgterm, IWorkItem.FULL_PROFILE);

results = queryClient.getResolvedExpressionResults(projectArea, statement, IWorkItem.FULL_PROFILE);

--
Regards,
Huanfeng,Cai

permanent link
Antonio Rossi (6) | answered Sep 28 '10, 9:25 a.m.
Hi,

For sorting I tried to use this way but it seems not work because I am doing something wrong.
What I want is to ordering by "MODIFIED_PROPERTY".
Can you help me and show me how to do this.


projectAreaAttribute = factory.findAttribute(projectArea,
IWorkItem.PROJECT_AREA_PROPERTY, auditableClient, monitor);

timeStampAttribute = factory.findAttribute(projectArea,
IWorkItem.MODIFIED_PROPERTY, auditableClient, monitor);

queryRefgterm = new Term(Operator.AND);

projectAreaExpression = new AttributeExpression(
projectAreaAttribute, AttributeOperation.EQUALS,
projectArea);

modifiedFromExpression = new AttributeExpression(
timeStampAttribute, AttributeOperation.GREATER_PLAIN, time);

queryRefgterm.add(projectAreaExpression);
queryRefgterm.add(modifiedFromExpression);

SortCriteria[] sortCriteria= new SortCriteria[] { new SortCriteria(IWorkItem.MODIFIED_PROPERTY, true) };
Statement statement = new Statement(new SelectClause(), (Expression) queryRefgterm, sortCriteria);

results = queryClient.getResolvedExpressionResults(projectArea,
(Expression) queryRefgterm, IWorkItem.FULL_PROFILE);

while (results.hasNext(monitor) {
//
.....
}



Thank you very much for your help.
Best Regards,

Tony

permanent link
Patrick Streule (4.9k21) | answered Mar 13 '09, 5:30 a.m.
JAZZ DEVELOPER
The RTC SDK article "Developer's Guide to Querying Work
Items" provides most of the information necessary to query and
view results. Is there a way to do the following programmatically:
- Query for "unresolved" work items. The Query Editor
allows you to specify that the "Status" attribute is
"unresolved" and/or "resolved"
- Sort the result set

Yes, both is possible:

For all the open states, you can add an expression like:

Expression openStates= new VariableAttributeExpression(stateAttribute,
AttributeOperation.EQUALS, new StatusVariable(IWorkflowInfo.OPEN_STATES));

For the sorting, you would create a statement like:

SortCriteria[] sortCriteria= new SortCriteria[] { new
SortCriteria(IWorkItem.ID_PROPERTY, ascending) };
Statement statement= new Statement(new SelectClause(), expression,
sortCriteria);

--
Regards,
Patrick
Jazz Work Item Team

Comments
SEC Servizi commented Mar 28 '19, 5:08 a.m. | edited Mar 28 '19, 5:09 a.m.
For the sorting, you would create a statement like:
SortCriteria[] sortCriteria= new SortCriteria[] { new SortCriteria(IWorkItem.ID_PROPERTY, ascending) };
Statement statement= new Statement(new SelectClause(), expression, sortCriteria); 
Or even more simple:
String[] sortColumns = { IWorkItem.ID_PROPERTY };
String[] sortDirections = { SortCriteria.ASCENDING };

Expression expression = QueryUtils.createSortedStatement(queryRefgterm, QueryUtils.createSortCriteria(sortColumns, sortDirections));

Cheers.

Your answer


Register or 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.