Find specific month using retrieved objects

0
Hi, Please assist me how to find the specific month using xpath in retrieve objects. Currently I using this code, but cannot get the correct answer. [month-from-dateTime(PresentDate)='[%BeginOfCurrentMonth%]']  
asked
2 answers
1

Hi

 

Parse your date like this to get your month in numbers

 

parseInteger(formatDateTime([%CurrentDateTime%],'MM'))

answered
1

Hi Muhammad,

 

What exactly are you trying to achieve?

The month-from-DateTime function returns the integer value of the month of the given date (see XPath Month-From-DateTime | Mendix Documentation). That said your current solution attempts to compare an integer with a dateTime attribute.

 

If you want to retrieve all the items for the current month you might want to try:

[PresentDate>='[%BeginOfCurrentMonth%]']

[PresentDate<’[%EndOfCurrentMonth%]']

 

Alternatively, you can amend your XPath to the following:

[month-from-dateTime(PresentDate)=month-from-dateTime('[%BeginOfCurrentMonth%]')]

Note that this solution will give you all the objects whose PresentDate attribute is (using September as an example) September, regardless of the year

answered