Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.3
Component:
search data
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 Mar 2009 at 14:01 UTC
Updated:
18 Oct 2010 at 22:20 UTC
I want to make a view of items that have been created in the current week. My view is a price-comparison, so old data is unwanted. How do I configure the view to take only the content/nodes from this week.
I think that I probably will have to look into arguments. But how can I make my argument be called so it always looks at current week????
My understanding of arguments is that I can make one view and decide with the argument which of the 52 weeks I will look at. But I dont want that. I want to dynamically look at current week in the view.
Please help.
Morten E.
Comments
Comment #1
excaliburst commentedIn other words how do I make an argument that will include only current/this week items in a view... ?
Morten
Comment #2
HTB commentedIt feels like this functionality should be easy to implement. all we need is access to a timestamps. but I cant find anyway to access timestamps.
However, I happened to note something within the SQL like this:
***CURRENT_DATE***You will spot this every time there is a filter based on dates. I haven't found anyway to access it though :-(
all we need is to be able to pull this stunt
(relevant_time - time stamp) relevant time is a week month etc so it would look like this
(current_day-7) dayfor a current week filter.I really dont want to result to using PHP, it would feel like using ducktape to plug a leak!
Comment #3
esmerel commentedIf you're using a date type of field, Node: Post date for example, you can use a filter on that field. With that filter, you can use an offset (it's part of the filter configuration) to use -7 days or whatever. I think that'll do what you're looking for.
Comment #4
excaliburst commentedThanks for you thoughts, but Esmerel, if I use a rolling 7 day filter, and one week fill out the content on friday and the next week on monday, then I would have mixed content from 2 weeks. So this is not a viable solution. I need it to be bulletproof.
I should not have to manually enter week no. in the content to filter on. I should be able to actually have Drupal know from the date, which week no the node where created.
Thanks
Morten
Comment #5
esmerel commentedSomething I should've seen before, but node arguments have "Node:Created Week" and "Node: Updated Week" as potentials, using the week number (1-52). Maybe some fiddling with that would give you what you're trying to get to?