ProcessInstanceQuery: Variable Value in List

Hi community,

currently, I am facing the following problem: I am trying to fetch process instances using java api. As condition I have a variable. However, I am not looking for one value of this variable, but I have a list of possible values of this variable.

I have solved the issue by using multiple queries. This approach is very slow.

for (String projectNumber : getProjectNumbers()) {
			ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
			processInstanceQuery//
					.variableValueEquals("projectNumber", projectNumber);
			processInstanceQueries.add(processInstanceQuery);
			
}
return processInstanceQueries//
			.stream()//
			.flatMap(query -> query.list().stream())//
			.collect(Collectors.toList());

So, what I am looking for is some method like ‘query.variableValueIn(“projectNumber”, listOfProjectNumbers);’

If I am fetching all process instances without the project number condition (variableValueEquals) the performance is better than using multiple quries.

I apreciate every hint or advise.

Best regards
Philipp