Flow not working as expected

I have a flow I am creating and it looks for an email in the collection. If the email isn’t there it is returning . Then the next condition is supposed to do something if that is the case:{
“filter”: {
“_and”: [
{
“$last”: {
“_neq”: null
}
},
{
“$last”: {
“_eq”:
}
}
]
}
} unfortunately it is giving me the following error: {
“name”: “Error”,
“message”: “Method no longer accepts array arguments: valid”
} Any suggestions would be appreciated. Thank you.

Hi Kevin,

I think some of your formatting was lost in your question. Can you try using this:

“$last”: {
“_null”: true
}

We have separate operators for ‘is null’ and ‘is not null’ and this may be causing the error.
For a full list of operators, you can view the docs here: https://directus.io/docs/guides/connect/filter-rules#available-operators

Unfortunately that didn’t work. :frowning:

So, on my website I have a questionnaire which is a lead generator. The responses go to a Questionnaire collection(this works fine).
Then, on creation of new entry to that collection it triggers a flow. This flow first checks what user_type they are and if they have an email address. It looks like this:
It’s a condition with {
“_and”: [
{
“$trigger”: {
“payload”: {
“email”: {
“_nempty”: true
}
}
}
},
{
“$trigger”: {
“payload”: {
“user_type”: {
“_nempty”: true
}
}
}
}
]
}
This works.
Then I run a Read Data to make sure that person isn’t already a customer in the Customers collection based on their email address:
{
“filter”: {
“email”: {
“_eq”: “{{$trigger.payload.email}}”
}
},
“limit”: 1
}
Which gives me payload: (that’s an empty array) if they aren’t already a customer

Then I ran another condition with your suggested code:
{
“$last”: {
“_null”: true
}
}

What’s tripping this up is that Read Data returns an array, even with "limit": 1, so “no customer found” comes through as [], not null. The flow Condition step then validates that in-memory payload, so this won’t match:

{
	"$last": {
		"_null": true
	}
}

If you want to check for “no results”, use a count check instead:

{
	"count($last)": {
		"_eq": 0
	}
}

If your Read Data operation has a key, I’d reference that key instead of $last, for example:

{
	"count(check_customer)": {
		"_eq": 0
	}
}

That’s a bit safer, because $last will point at a different operation if you reorder the flow later.