0
votes

I have an array (varMyArray) coming in a Mule flow as shown below (sample given below):

{Test={Name=Test, Id=1000000, type=Emp, EmpDetails={Name=Chan, Id=1000001, Type=Dist Mgr}}}

I'm on dataweave 1.0 and is trying to check if the array is empty or not using the below code:

%dw 1.0
%output application/java
---
0 when (flowVars.varMyArray.size() == 0) otherwise 1

When the array value is as given above, I get 1 as dataweave output. However when the array is empty (size = 0) the dataweave is still returning 1. Please let me know the correction to be made?

1

1 Answers

1
votes

Try this: 0 when ((sizeOf flowVars.varMyArray) == 0) otherwise 1