Sort process instances by variable value

Hello, is there a way when searching for process instances with the Java API to sort by variable value?
I found this method in AbstractQuery:
orderBy(QueryProperty property, NullHandlingOnOrder nullHandlingOnOrder)

but if I set a VariableInstanceQueryProperty there, it generates an invalid SQL query and the DB throws an error.

Hey @ErmannoRusso,

You can’t pass just anything you want in that QueryProperty, you’ll need to know what you are passing for it to work properly and generate a valid SQL.

Regarding your question and sorting by variable value. This is a bit tricky to achieve, since a single process instance might have multiple values, which means that on the SQL level you will get multiple rows for one process instance, due to the join on the variables table. Once you have this multiple values it makes it really difficult to sort, since paging will no longer work.