in C# I am trying to select nodes where the "event" date is a specific date, but the "event" date property also includes time (i.e. it is a DateTime field).
I tried -
uQuery.GetNodesByXPath("$currentPage/ancestor-or-self::root//EventListPage/* [@isDoc and umbraco.library:ShortDate(eventDate) = '" + d.Date.ToShortDateString() + "']")
The problem here is that the call that uQuery makes has no context of the "umbraco.library" class - so can't apply that logic. Only raw/pure XPath queries will work - same applies with "umbraco.library:GetXmlNodeByXPath" method.
Could try a substring function to truncate the string to the desired length? (I'll try to find an example)
I removed the $currentPage part, as uQuery will query from the root node anyway, no point finding the current page navigating all the way up, then back down the XML tree again.
Select nodes by Date but ignore Time
in C# I am trying to select nodes where the "event" date is a specific date, but the "event" date property also includes time (i.e. it is a DateTime field).
I tried -
uQuery.GetNodesByXPath("$currentPage/ancestor-or-self::root//EventListPage/* [@isDoc and umbraco.library:ShortDate(eventDate) = '" + d.Date.ToShortDateString() + "']")
but it complains about the ShortDate function.
I suspect I may be approaching this wrong!?
Hi Gordon,
The problem here is that the call that uQuery makes has no context of the "umbraco.library" class - so can't apply that logic. Only raw/pure XPath queries will work - same applies with "umbraco.library:GetXmlNodeByXPath" method.
Could try a substring function to truncate the string to the desired length? (I'll try to find an example)
Cheers, Lee.
How's about something like this?
I removed the $currentPage part, as uQuery will query from the root node anyway, no point finding the current page navigating all the way up, then back down the XML tree again.
Cheers, Lee.
Thanks Lee, that sorted it :-)
is working on a reply...