AnsweredAssumed Answered

Get last value of process variable

Question asked by dominik.eisenberg on May 14, 2013
Latest reply on May 15, 2013 by jbarrez
Hi,

i have a problem getting the last value of process variables after the process execution has finished.

First i tried, to request all historic variables, but some variables are included multiple times in the response of the following request, differing only in its Id and Value:

<code lang="java" linenumbers="normal">
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery()
                    .processInstanceId(historicProcessInstance.getId()).list();
</code>

I also tried to use historic detailed query, to get variable updates, ordered by time, but unfortunately some variable updates occured at exactly the same timestamp.

<code lang="java" linenumbers="normal" start="3">
List<HistoricDetail> variableUpdateList = historyService.createHistoricDetailQuery()
                    .processInstanceId(historicProcessInstance.getId()).variableUpdates().orderByTime().desc().list();
</code>

Questions:
So is there a way, getting the last value of process variables (running/finished process instances)?
Is it a rule, that the id of historic variables and historic variable updates is allways incremented? Could this be a workaround for me?

Thanks,
Dominik

Outcomes