Reputation: 21
Use Case: I have a collection with consulant with a field birhdate.
Now I want to create a flow to read all consultant who have birthday this month.
{
"collection": "Consultant",
"query": {
"filter": {
"month(birthdate)": {
"_eq": "month($now)"
}
}
}
}
Does not work!!!
When I hardcode the month it works nicely
{
"collection": "Consultant",
"query": {
"filter": {
"month(birthdate)": {
"_eq": "7"
}
}
}
}
Any suggenstions?
extract current month out of $now in a filter
Upvotes: 2
Views: 1776
Reputation: 1
Although certain Operations in Flows use filter rules, dynamic variables are not available in Flows.
Upvotes: 0
Reputation: 1918
From the Directus documentation, https://docs.directus.io/reference/filter-rules.html#dynamic-variables, you can see:
Although certain Operations in Flows use filter rules, dynamic variables are not available in Flows.
I would create an "Run Script" Operation to extract the month, and use it your filter. see https://docs.directus.io/app/flows/operations.html#run-script
Upvotes: 1