Hi Reto,
First of all thank's for your help.
You probably don't use the 6.1 Designer Version. Your query doesn't work because of the executor().
It tooks me a lot of time to find a way to get the runtime of the last running case. See below.
import ch.ivyteam.ivy.workflow.CaseState;
import ch.ivyteam.ivy.workflow.query.CaseQuery;
import ch.ivyteam.ivy.workflow.ICase;
CaseQuery caze = CaseQuery.create().where().name().isEqual("Laufzeit").and().state().isEqual(CaseState.DONE);
Number count = ivy.wf.getCaseQueryExecutor().getCount(caze);
ivy.log.info("count "+count); //Zähler prüfen
if (count != 0){
Recordset erg = ivy.wf.getCaseQueryExecutor().getRecordset(caze.groupBy().businessRuntime());
ivy.log.info("letzteRuntime "+erg.getField(count-1,0));
}