fas-dev
(faso dev)
February 24, 2022, 8:30pm
1
I want to do a flow query by retrieving the data whose endDate
field is greater than the current date or not filtering if the field is empty or null.
After my research, it seems that I have to use filter
, but I don’t know how to do it.
Below is my implementation that doesn’t work.
return $this->query()
->find("[instanceof TC.Calendar:Document.AbstractEvent][_hidden=false]")
->filter('[endDate=""],[endDate >= "' . (new DateTimeImmutable())->format('d-m-Y H:i') . '"]')
->sort('startDate', 'ASC')
->get();
NB: in PHP and not in fusion
fas-dev
(faso dev)
March 9, 2022, 11:55am
2
Hello everyone, it’s been 2 weeks now that I’m confronted with the filtering of my data based on a datetime field. I can’t find any documentation explaining how to filter data based on a DateTime field.
I am a new developer in this CMS.
I am asking for help to advance my project. Thanks
sebobo
(Sebastian Helzle)
March 9, 2022, 1:21pm
3
Hi,
you can use the filterByDate
operation from this package: Flowpack.Listable/FilterByDateOperation.php at master · Flowpack/Flowpack.Listable · GitHub
Either by installing the package or by integrating this operation into your project.
Hope that helps.
2 Likes
fas-dev
(faso dev)
March 9, 2022, 1:33pm
4
@sebobo Thanks a lot for the feedback, I’ll install it and test it, then get back to you. Thanks again for the feedback.
fas-dev
(faso dev)
March 9, 2022, 1:45pm
5
@sebobo Thanks, this work perfectly.
1 Like