Processinstance query multiple variable filter

I trying to filter the process instances using multiple variables , the below query works like OR condition, but I need an AND condition, can you someone suggest how we can achieve this using Java APIs ?

also will there be any performance issues if we use multiple variableValueLike in the same processinstance query like below?

Any help is appreciated …

runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_DEF_KEY).active()
.variableValueLike(“ID”,
(checkEmpty(searchObj.get(“ID”)) : searchObj.get(“ID”).toString()))
.variableValueLike(“Region”,
(checkEmpty(searchObj.get(“Region”)) : searchObj.get(“Region”).toString()))
.variableValueLike(“Country”,
(checkEmpty(searchObj.get(“Country”)) ? searchObj.get(“Country”).toString()))

Instead of using variableValueLike function, try the variableValueEquals function.

I am using the like since I am using this call for search functionality where in the values may or may not be provided from the UI. and in cases if it is not provided I can use % …

thanks for the prompt response. but have you used multiple filters like this before ?

yep. But not Java API. I was using Camunda Rest API for multiple variables filtering.

I use the combination of various operators: like, equal, not equal, etc.

Hi @kannan,

how did you come to the conclusion that the statements are combined by OR?
Multiple conditions should be combined by AND.

Do you have a log of the database statements?

Cheers
Tobias

Can you please give an example on this