I need to filter nodes created in the current quarter, where starting and ending dates of each quarter are customly configured (but always the same within a year.)
Do I need to make a custom query or can it be done with arguments or with some other more or less automated way?
Thank you Mihaela
Mihaela,
The following assumes that you have the Views module installed: http://drupal.org/project/views
Create a view and use the filters section and click in the small+ symbol and select the followinf filter: "node: post date". Or, if you have a custom date field you created for that content type (requires both the cck http://drupal.org/project/cck and date http://drupal.org/project/date modules), then select the filter "content: field_<your custom field name>".
Those date filters can handle selecting dates within a range.
I'm not 100% sure I understood the question. Let me know if this helped.
Shai
On Dec 12, 2009, at 10:42 PM, Prkos prkos@prkos.hr wrote:
I need to filter nodes created in the current quarter, where starting and ending dates of each quarter are customly configured (but always the same within a year.)
Do I need to make a custom query or can it be done with arguments or with some other more or less automated way?
Thank you Mihaela -- [ Drupal support list | http://lists.drupal.org/ ]
On Sat, Dec 12, 2009 at 9:42 PM, Prkos prkos@prkos.hr wrote:
I need to filter nodes created in the current quarter, where starting and ending dates of each quarter are customly configured (but always the same within a year.)
Do I need to make a custom query or can it be done with arguments or with some other more or less automated way?
I see a couple ways to do this.
1. Add a cck field to your node with the quarter. The user has to select the correct quarter from a list of acceptable values. This is the absolute simplest way I can think of doing this.
2. Use a Computed Field[1]. You should be able to configure it to set the correct quarter based on some date field (either a CCK date, or one of the nodes dates). I've never used this module so YMMV. This looks like it'd be the cleanest solution.
3. Use a in between filter on your date field in views. Make a custom module with a hook_form_alter to hide the min and max fields, add a dropdown with the quarter and write some javascript to set the min and max.
On Saturday 12 December 2009 9:42:06 pm Prkos wrote:
I need to filter nodes created in the current quarter, where starting and ending dates of each quarter are customly configured (but always the same within a year.)
Do I need to make a custom query or can it be done with arguments or with some other more or less automated way?
Thank you Mihaela
It's not "current", but a related module is the Views Date Range argument handler:
http://drupal.org/project/views_daterange
That works by giving you a configurable summary view that when you click on a link gives you whatever range of dates that is. It has no way to detect "current", so it won't solve your use case entirely, but it may be useful for inspiration at least.