How to send an error if a filter returns more than one result?

:bullseye: What is your goal?

To send an error if a filter returns more than one result

:thinking: What is the problem?

Hi everyone,

I’m working on a scenario where I expect the filter to allow only one result to pass through. However, in some cases, the filter matches multiple bundles.

What I would like to achieve is:
If the filter returns more than one result, the scenario should automatically throw an error and stop execution.

Is there a recommended way to validate that only one bundle passes after a filter and trigger an error if the count is greater than one?

Thanks in advance for your help!

:camera_with_flash: Screenshots: scenario setup, module configuration, errors

1 Like

Hey Zainab,

put an aggregator after it and check the length of the resulting array. One route if its only one item inside the array with the rest of the flow and a second route with a misconfigured module to throw an error if the array length is more than one. I usually use a parse JSON module with something that isn’t a JSON inside.