Search code examples
activitijuel

Error in activity expression - Ask array if not empty


I try to use following expression in activity in an exclusive Gateway :

 ${(MediaScanResult.videoInfo.videoTracks != 'empty' )}

videoTracks is an Array. I want to know if this is not empty.

I got following Error Message:

Error while Calling BPMN: org.activiti.engine.ActivitiException: 
Error while evaluating expression: ${MediaScanResult.videoInfo.videoTracks != 'empty' )}

Any Idear how to check this?


Solution

  • You can't check an array to be empty like that, it should be something like (assuming it's a plain array):

    ${(MediaScanResult.videoInfo.videoTracks.length > 0 )}

    to be safe, you could add a null check before that, to make sure it exists:

    ${(MediaScanResult.videoInfo.videoTracks != null && MediaScanResult.videoInfo.videoTracks.length > 0 )}

    (Sidenote: the Activiti modeler has a download button so you can get the BPMN 2.0 xml.)