1 Reply Latest reply on Jan 19, 2011 8:53 AM by Jon Bionda

    Sorting List of tasks

    hkho Level 1

      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?


        • 1. Re: Sorting List of tasks
          Jon Bionda

          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.addCondition(TaskSearchingConstants.pPROCESS_INSTANCE_ID, Operator.EQUALS, Long.valueOf(processInstanceId));


               List results = tmqs.taskSearch(taskSearchFilter);


          Hope this helps.