cancel
Showing results for 
Search instead for 
Did you mean: 

HistoricProcessInstanceQuery query over multiple process variables

godofwar
Champ in-the-making
Champ in-the-making
Hello this is a scenario that describes my problem,
I have a workflow that contains a multiple/multi-valued property named documentVerificators which is an association with cmSmiley Tongueerson
I started an instance of this workflow and selected two users in the property documentVerificators: admin and Jack.
I want to use the HistoricProcessInstanceQuery in order to find the instances that have the user "admin" in their documentVerificators property.

Those are the available methods in the service:

variableValueEquals
variableValueNotEquals
variableValueGreaterThan
variableValueGreaterThanOrEqual
variableValueLessThan
variableValueLessThanOrEqual
variableValueLike

I didnt find someThing like variableValueIn to filter over multiples process variables.

Do you have any idea how to make that work please ?
5 REPLIES 5

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

I didnt find someThing like variableValueIn to filter over multiples process variables.
Can't you use multiple variableValueEquals with .or?

Variable values stored in byte arrays are not searchable.

Regards
Martin

I have checked the database , multiple variables are stored in byte arrays :
I do not have <code>.or</code>method in my api version,but i have mentioned only one user in documentVerificators which is admin and then i tried with
<code>query.variableValueEquals(propertyName, ActivitiScriptNode);
</code>
ActivitiScriptNode is the activitiscripnode of the admin user
Result: no instances found
I tried also with
<code>query.variableValueEquals(propertyName, ActivitiScriptNodeList);
</code>
ActivitiScriptNodeList contains only the ActivitiScriptNode of the user admin
Result: I get this message: Variables of type ByteArray cannot be used to query

jbarrez
Star Contributor
Star Contributor
> Variables of type ByteArray cannot be used to query

You can only query on primitives (this is what databases allow).

Make sure your variables are stored as a String and not serialized as Java object (and thus bytes). Using serialization, you lose all query capabilities on it.

pandu
Champ in-the-making
Champ in-the-making
I'm wondering if it's possible to query tasks by giving multiple task ids at once? I'm sure .or is not working in the case of multiple taskIds, it would only fetch the last id given.

Similar thing exists for process queries: ProcessInstanceQuery#processInstanceIds(Set<String>) but not for TaskQuery.

Any ideas?

Thank you.

cjose
Elite Collaborator
Elite Collaborator
I don't think it exist for tasks. But it is achievable using the NativeTaskQuery where you can write your own SQL query where you can specify multiple task ids. Please see http://www.activiti.org/userguide/#queryAPI (Query API section in user guide)

Regards,
Ciju