cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with CreateTaskQuery with multiple taskVariables

omkarrege
Champ in-the-making
Champ in-the-making
hi,

My task contains certain local variables (String)

Its getting stored in ACT_RU_VARIABLES table in DB.

e.g.

Name_                | Text_                | task_id_
CustName1        | CustVal1           | 101
CustName2        | CustVal2           | 101
CustName3        | CustVal3           | 101
CustName1        | CustVal1           | 102
CustName2        | CustVal2           | 102


I want to retrieve the tasks based on following criteria
Tasks having Name_ as CustName1  and value as CustVal1  and  Name_ as CustName2  and value as CustVal2  
     
I am using  createTaskQuery but it is not retrieving tasks. I am expecting task_ids 101, 102 to be retrieved..

Statement in JAVA code is as below
List<Task> myTask_1 = taskService.createTaskQuery().taskVariableValueEquals("CustName1", "CustVal1").taskVariableValueEquals("CustName2", "CustVal2").list();


I am not able to form the native query for this which i feel would become complex.

Can you suggest what can be done in this case?
Is something wrong with the code i have written?  why its not retrieving the tasks?
Please advise.

Omkar
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
This is not possible with the Query Api at this moment. What you want is actually

'all tasks where (name is custName1 and value is custVal1) OR (name is custName2 and value is custVal2)

This needs to be done with a native query, the OR bit is not yet implemented in Activiti.