Question for Course: Constrain your data using XPath

0
Module 4.5.3 of Constrain your data using XPath wants to obtain all VacationRequests that have been approved and start this year. They achieve this with the following XPath query: [Status= 'Approved’ and StartDate > ‘[%BeginOfCurrentYear%]’]   First of all I would expect this query to exclude items with a StartDate on january firsts of the current year. This is not the case. Can you explain to me why? Next this constraint is to broad since vacationRequests with StartDate next year (2025) will also be included in this list.  Is there a way that I can explicitly compare on the year field.
asked
2 answers
2

To answer your question regarding  ‘[%BeginOfCurrentYear%]’] and why it also includes requests on the 1st of january - This datetime is the actual beginning of the year, 01-01-YEAR 00:00:00. This means that any leave that is requested starting later than 00:00:00 will be included in the retrieve. 

answered
0

My appologies. I've already solved the question myself. By using the year-from-dateTime function, I can achieve the goal of the assignment more effectively. The end result is:  [Status='Approved' and year-from-dateTime(StartDate) = year-from-dateTime('[%BeginOfCurrentYear%]')]

I will open a ticket in the course and ask them to correct the lecture.

answered