retrieving records of an entity where Birthdate=current day

1
Hi, I'm trying to write an XPath constraint which will retrieve all Entities where Birthdate attribute is the current day. I am trying the following but it is not working: [day-of-year-from-dateTime(Birthdate) = day-of-year-from-dateTime('[%BeginOfCurrentDay%]')] Any advice?
asked
2 answers
1

You'll have to extract the day number first using one of the format datetime expressions as mentioned on https://world.mendix.com/display/refguide5/Parse+and+format+date+function+calls

Something like this (untested btw) :

https://modelshare.mendix.com/models/1362087d-f8ca-4e43-8cc7-5051f10907ac/format-and-retrieve-based-on-day-example

answered
0

Since day of year is not really a thing you can query on, I would advise you to store this day as a number so you can easily query on it later. This can be done as some after-commit event or maybe in the microflow where you store this date. There you can extract the number of the day and just add that as a helper attribute. You can extract the day using the formatting functions described on https://world.mendix.com/display/refguide5/Parse+and+format+date+function+calls

answered