XPath for older than 1 year

0
Hi,  I’m trying to do the additional challenges in section 4.7 of the “Constrain Your Data Using XPath” learning path.  If I have a request entity with a StartDate, what’s the simplest way to constrain my data on “requests that are older than 1 year”? I can think of a very long-winded way of doing it by looking at the year, month and date fields separately, but there must be a simpler way to do it.  Thanks! Maarten PS I’m actually on 9.1.1, but this option isn’t in the dropdown yet!?
asked
3 answers
5

Create a datetime variable and name it OneYearAgo, set it to:

addYears([%BeginOfCurrentDay%], -1)

Then, set the xpath like this to find all objects with the date before the created date:

[StartDate < $OneYearAgo]

 

answered
6

You can also use the system variable [%YearLength%]. For me the solution worked directly in the XPath constraint.

StartDate <'[%CurrentDateTime%] - [%YearLength%]']

 

answered
0

Thanks @ruud, why didn’t I think of that!?

answered