Forum Discussion
SaraFennah
Aug 18, 2016MVP
Content Query Web Part and Dates
Whilst more of an advanced user rather than a developer myself, I think only a developer can answer my question. I am trying to display a list of entries from my custom list where the [Order Date] i...
SaraFennah
Aug 18, 2016MVP
Thanks for the tips. The 7 day filtering around today won't work in this scenario as the view needs to only show current week not last 7 days. Current week being Monday to Sunday. So on a Monday, I need to see only today, on Tuesday today and yesterday, etc.
Waldek Mastykarz
Aug 19, 2016Copper Contributor
One way to go around it would be to define a query that would get items from previous 7 days to next 7 days: that way you would be safe on Sunday (getting items from the past week) as well as on Monday (getting items from the upcoming week). You could then sort items ascending by the date and do filtering in XSLT. The https://msdn.microsoft.com/en-us/library/dd583143(v=office.11).aspx contains some date manipulation functions that could help you with that. It's not trivial but it's definitely doable. It's worth noting that this approach would work if the list of items is not huge and retrieving items from -7 days to + 7 days wouldn't return hundreds of items.
Hope this helps,
Waldek