-
Feature Request
-
Resolution: Fixed
-
L3 - Default
-
None
-
None
-
None
AT:
- the task query supports sorting by process variable
- it is possible to sort by at least 2 process variables at a time
See: http://docs.camunda.org/latest/api-references/rest/#task-get-tasks-post
Constraints:
1. The type of the variable must be declared in the API; this is due to the different variables (Integer, String, ...) being stored in different database columns; it is quite complex to express in standard SQL (if at all) to dynamically select values from different columns and merge them into one to afterwards sort rows based on that column; furthermore, not all databases are able to convert different data types to a common type (example: SELECT 'a string variable' UNION select 123 won't work on postgres; the same when you exchange the literals in the statement by column names)
2. The scope of the variable must be declared in the API (i.e. if it's a task, process, local execution, case or local case execution variable). Perhaps we can remove this constraint if we find an efficient way for the join with variables on different scopes
3. the API may look like this: taskQuery().orderByProcessVariable("a variable name", ValueType.STRING).orderByProcessVariable("another variable name", ValueType.INTEGER); This has the following semantics: the primary ordering is by "a variable name", the secondary ordering by "another variable name". If a process has a variable "a variable name" that is not a String variable, that variable is treated like a null String variable.
4. by taskQuery().orderByProcessVariable("a variable name", ValueType.STRING).orderByProcessVariable("a variable name", ValueType.INTEGER) it is possible to apply a secondary ordering over the same variable of a different type; this results in all the tasks with integer variables being grouped together (since their value for primary ordering is null) but internally ordered by their integer variable ordering (as it's the secondary ordering)
5. We do not plan to offer a general method orderByProcessVariable(name) if that would mean that we internally apply a primary, secondary, tertiary, ... ordering over all available value types. The reason is that it is not clear in which order they should applied, i.e. if we should primarly order by string type or integer type, etc..
6. we apply toLowerCase for text columns to create a more natural ordering of String variables
7. The implementation will very likely not be extensible when you add custom ValueTypes. Since this is not a supported feature, this seems to be no problem.
This is the controller panel for Smart Panels app
- is related to
-
CAM-3411 Using the REST API, I can order tasks by variable values
- Closed