You're right that those functions are not available in Xpath, but as Michel suggested, you can use the microflow function trimToDays
. There are two different strategies you can follow, depending on how you use the date attributes:
trimToDays
when setting the attribute. This way you can use the (simple) Xpath restriction you mentioned in your question. The disadvantage however is that you must be careful never to commit a "non-trimmed" date, or this solution won't work (this also means you can't use the token [%CurrentDateTime%]
, but instead must use [%BeginOfCurrentDay%]
).If you don't want to trim the time part of the attributes in your database, you can use an Xpath restriction like this:
[effectiveDate >= $startOfDay and effectiveDate < $endOfDay]
Using this solution, you first need to create the $startOfDay
and $endOfDay
microflow variables:
$startOfDay = trimToDays($anotherObject/effectiveDate)
$endOfDay = addDays($startOfDay, 1)
You might also consider retrieving:
[day-from-dateTime(effectiveDate) = day-from-dateTime ($anotherObject/effectiveDate)]
[month-from-dateTime(effectiveDate) = month-from-dateTime ($anotherObject/effectiveDate)]
[year-from-dateTime(effectiveDate) = year-from-dateTime ($anotherObject/effectiveDate)]
This results in a ‘cleaner’ microflow in my opinion.
Martin,
I guess the easiest way is to use microflow the set the second effictiveDate and use the function 'trimtoDays'
How we can do these date comparisons in Mendix Native XAPTH?
Any ideas
Thanks in advance