Add example for testing null field in flow condition
Page
https://docs.directus.io/reference/filter-rules.html#filter-operators
Describe the Inaccuracy
Hi, Maybe I picked the wrong doc page and it should be in Guiides -> Flow as an example. I was trying to test if a slug field was null in a flow so I used the following condition:
{
"$trigger": {
"payload": {
"slug": {
"_null": true
}
}
}
}
The condition would pass with the payload { "slug": null } but it would fail with the payload {} because of the requireAll property in directus/api/src/operations/condition/index.ts I would expect the validation to succeed when the field is missing. But I know that there were other problems when the requireAll property was missing.
So finally I've came up with this solution:
{
"$trigger": {
"payload": {
"slug": {
"_nnull": true
}
}
}
}
Now the condition succeeds when the field exists and is not null and it fails otherwise. So I execute the rest of the flow when the condition fails. I just thought that this example could be written somewhere and that the doc indicates that all the fields in condition are required in the payload.
You could also use _empty or _nempty if you want to check whether it has a value or not.
Could you write some documentation to describe what you think is missing? I've submitted several documentation fixes and the team is happy to look at them.