How to filter a route on empty array

I’m trying to create a filter that skips a route if an array is empty.

The scenario is triggered when someone fills out a form. The from has conditional logic, and based on the form inputs, the form may, or mey not, include one or more arrays of files.

If there are any arrays with files, they should be uploaded to a folder in Google drive.

If the array is empty, there is no need to go through the steps to upload the files and should be filtered out.

In the output bundle from the form trigger an epmty array looks like this:
image

And an array with files looks like this:
image

The relevant part of the scenario:

Earlier in the scenario I have merged several arrays from the form into one array using a “set multiple variables” module like this:
image

The output bundle of the merged arrays looks like this with files:
image

And like this if the merge results in an empty array:
image

I have tried to set up the filter like this:

when that did not work, i tried to set up a variable like this:
image

and the filer like this:

How can I set up the filter to make it work? Any Ideas?

Cheers!

Hey there
Instead of using what you are right now
Use length function in filter
And set it not equal to zero
length(Array)
Not equal to
0

2 Likes

Thank you!

That solved it. :trophy:

2 Likes

You’re overcomplicating things.

Why not just use the in-built array filter options?

Screenshot_2024-02-07_090257

3 Likes

Yeah. That’s what I thought he ment and ended up doing. :slight_smile: