Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Sorting List of tasks

Avatar

Level 3

Hi, I've created a custom componet to retrieve task information, I use TaskSearchFilter to search the tasks, but how can I sort the task list?

I know there is filter.addSortDesc(String) and filter.addSortAsc(String), but I am not sure what to put if I want to sort by task id or completion date.

I tried to put addSortDesc("TaskId") or addSortDesc("Id") but it seems not working. Is there any docs/reference available for the list of attributes I can sort by?

thanks

1 Accepted Solution

Avatar

Correct answer by
Level 4

There is a constants file in the taskmanager client jar. Here is a sample of how we use the filter to get tasks for a provided processinstanceid. We did the sort on pCREATION_TIME but this could easily be changed to pID to sort by task id.

TaskManagerQueryService tmqs = TaskManagerClientFactory.getQueryManager(clientFactory);

TaskSearchFilter taskSearchFilter = new TaskSearchFilter();

taskSearchFilter.addSortDesc(TaskSearchingConstants.pCREATION_TIME);

taskSearchFilter.addCondition(TaskSearchingConstants.pPROCESS_INSTANCE_ID, Operator.EQUALS, Long.valueOf(processInstanceId));

List results = tmqs.taskSearch(taskSearchFilter);

Hope this helps.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

There is a constants file in the taskmanager client jar. Here is a sample of how we use the filter to get tasks for a provided processinstanceid. We did the sort on pCREATION_TIME but this could easily be changed to pID to sort by task id.

TaskManagerQueryService tmqs = TaskManagerClientFactory.getQueryManager(clientFactory);

TaskSearchFilter taskSearchFilter = new TaskSearchFilter();

taskSearchFilter.addSortDesc(TaskSearchingConstants.pCREATION_TIME);

taskSearchFilter.addCondition(TaskSearchingConstants.pPROCESS_INSTANCE_ID, Operator.EQUALS, Long.valueOf(processInstanceId));

List results = tmqs.taskSearch(taskSearchFilter);

Hope this helps.