Comparing dates in retrieve in xpath

0
Hello, I'm new to mendix and I ran into a problem comparing dates in mendix.   My task is to collect data whose date is one to the date of the last month. e.g. date>=01.04.2023 && date<=30.04.2023     What is the easiest way to select the beginning of the last month and the end of the last month.   Thank in advance.
asked
2 answers
1

See the documentation here: https://docs.mendix.com/refguide/xpath-keywords-and-system-variables/

You can use stuff like [%BeginOfCurrentMonthUTC%] or [%EndOfCurrentMonthUTC%]. And do note that that you can also calculate when you use for instance '[%BeginOfCurrentMonth%] + 3 * [%MonthLength%]'

And also note that you have UTC and non UTC commands. A must read is this: https://docs.mendix.com/refguide/datetime-handling-faq/

Regards,

Ronald

 

answered
0

See the documentation for xpath keywords. These should help you out. Alternatively, create datetime variables in your microflow first using functions like addWeeks, addDays etc and compare Datum to those instead of calculating in xpath.

Also, in your screenshot you have two separate constraints over Aricle, meaning you retrieve Sales when it’s associated with an Aricle where Naziv = IteratorAricle/Naziv. Also it needs to be associated with an Aricle where Datum is constrained, but this Aricle is not necessarily the same as the one where you compared the Naziv. If you need those two constraints to be true for one and the same Aricle, write your XPath like:

[MyFirstModule.Sales_Aricle/MyFirstModule.Aricle[Naziv = $IteratorAricle/Naziv and Datum > blah]]

 

answered