Counting Items In An Array

I’m aggregating some data into an array like this -

Which produces an JSON string like [] or [{"id":"1702652e-761d-4d60-8caa-4a8e7871a4eb"}]

and I want to filter my scenario so that it doesn’t continue if the length of the array is 0. Should be nice and simple right?

But of course, that doesn’t work - the filter criteria always evaluates to true. Can anyone tell me what I’m doing wrong here?

No, the output of the “Aggregate to JSON” module is of variable type string (text), NOT an array!

You should not use the “Length” function to check the length of the resulting string, because it will always be longer than 0. This is because when there are no items, the output of the JSON module string is [] – which has 2 characters in it [ and ]

The preferred way to stop executing the rest of the scenario when the aggregator aggregates no items, is to check the “Stop processing after an empty aggregation” field.