It's all about the answers!

Ask a question

Work with Query Results in RTC (Java API client side)


Pavel Cikota (13510) | asked Jun 25 '19, 9:20 a.m.
edited Jun 25 '19, 9:53 a.m.

 IBM RTC 5.0.2 (client side)


I have query (already build) who return 2 columns with workItem ID and text custom field from all workitems from current Project Area. How can I get only result values, without getting WorkItem from queryResult, and get custom filed from him (it works, but takes a lot of time on big result set)?


my code:
=======================================================================================

IQueryDescriptor query = findPersonalQuery(pa, queryName, mon); //function for find queryDescriptor by name


if (query != null) { //query_find!

IWorkItemClient workItemClient = (IWorkItemClient) repo.getClientLibrary(IWorkItemClient.class);

IQueryClient queryClient = workItemClient.getQueryClient();

IQueryResult unresolvedResults = queryClient.getQueryResults(query);

if (unresolvedResults != null) { //query_OK


long total = unresolvedResults.getTotalSize(mon);

long pages = (total % 256);

long curPage = 0;

ResultSize resultSize = unresolvedResults.getResultSize(mon);

IAuditableCommon auditableCommon = (IAuditableCommon) repo.getClientLibrary(IAuditableCommon.class);



while (unresolvedResults.hasNext(mon)) { //GO_to_results_in_page

IResult result = (IResult) unresolvedResults.next(mon);

IWorkItem workItem = auditableCommon.resolveAuditable((IAuditableHandle) result.getItem(), IWorkItem.FULL_PROFILE, mon);

 

// get custom text attribute

String val = getCustomAttributeValueByIdentifierAsString(workItem, repo, "custom.field.identifer.txt", mon, true);


} //GO_to_results_in_page



} //query_OK

else System.out.println("INFO : no results!");

} //query_find!

else System.out.println("ERROR  : query \"" + queryName + "\" not found!!!");


=======================================================================================

I try use IWorkItem.SMALL_PROFILE  but it did'n get some performance.

One answer



permanent link
Ralph Schoon (63.1k33646) | answered Jun 26 '19, 1:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 You can only use the API as it is. You can get the result resolved or unresolved. If you want to get at attribute data you have to finally resolve the work item. You can get resolved results and you can use resolve for multiple work items that might perform faster, but ultimately the best way to use a query is to NOT get all work items back but only a subset defined by the conditions.


Here what I know about the API:


Comments
Ralph Schoon commented Jun 26 '19, 1:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Also the query API returns the work items and not the columns. The columns are a UI implementation on a different API level as far as I understand. 

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.