I'm trying to create a news archive view. This seems to be almost working. If I supply an argument to the view, i.e. 200903, I get all news-items for March. However, if there is no argument supplied, I would like to get a list of all available months with the number of news-items in brackets (similar to what you get when using the argument 'Created year + month'). However, I only get a list with this month, i.e. something like "March 2009 (25)". This is the query for that case:

SELECT DATE_FORMAT(ADDTIME(STR_TO_DATE(node_data_field_datum.field_datum_value, '%Y-%m-%dT%T'), SEC_TO_TIME(7200)), '%Y-%m') AS node_data_field_datum_field_datum_value,
   COUNT(DISTINCT(node.nid)) AS num_records
 FROM node node 
 LEFT JOIN content_field_datum node_data_field_datum ON node.vid = node_data_field_datum.vid
 WHERE (node.status <> 0) AND (node.type in ('agenda'))
 GROUP BY node_data_field_datum_field_datum_value
  ORDER BY node_data_field_datum_field_datum_value ASC

When an argument is supplied, the query looks as follows:

SELECT node.nid AS nid,
   node_data_field_datum.field_datum_value AS node_data_field_datum_field_datum_value,
   node.type AS node_type,
   node.vid AS node_vid,
   term_image.tid AS term_image_tid,
   node.title AS node_title
 FROM node node 
 LEFT JOIN content_field_datum node_data_field_datum ON node.vid = node_data_field_datum.vid
 LEFT JOIN term_node term_node ON node.vid = term_node.vid
 LEFT JOIN term_image term_image ON term_node.tid = term_image.tid
 WHERE ((node.status <> 0) AND (node.type in ('agenda')))
    AND ((DATE_FORMAT(ADDTIME(STR_TO_DATE(node_data_field_datum.field_datum_value, '%Y-%m-%dT%T'), SEC_TO_TIME(7200)), '%Y-%m') <= '2009-03' AND DATE_FORMAT(ADDTIME(STR_TO_DATE(node_data_field_datum.field_datum_value, '%Y-%m-%dT%T'), SEC_TO_TIME(7200)), '%Y-%m') >= '2009-03'))
   ORDER BY node_data_field_datum_field_datum_value DESC

Am I perhaps missing something? I hope someone can help.

Comments

arlinsandbulte’s picture

Status: Active » Postponed (maintainer needs more info)

I am not sure what you are trying to explain here...
Is your issue still active?

Could you modify the default argument settings to do what you want???

pvanderspek’s picture

Status: Postponed (maintainer needs more info) » Fixed

Sorry for taking such a long time to get back to this. In the mean time, the problem has slightly changed. I now get a list like this one:

* November, 2009 (152)
* December, 2007 (53)
* January, 2008 (87)
* February, 2008 (90)
* March, 2008 (96)
* April, 2008 (79)
* May, 2008 (61)
* June, 2008 (49)
* July, 2008 (32)
* August, 2008 (23)
* September, 2008 (54)
* October, 2008 (89)
* November, 2008 (91)
* December, 2008 (77)
* January, 2009 (94)
* February, 2009 (98)
* March, 2009 (100)
* April, 2009 (76)
* May, 2009 (56)
* June, 2009 (52)
* July, 2009 (26)
* August, 2009 (20)
* September, 2009 (64)
* October, 2009 (84)
* November, 2009 (69)

As you can see this is almost correct,but November 2009 is listed more than once, but with different values. Any idea what might be going wrong here?

arlinsandbulte’s picture

Thanks for replying...
About the November 2009 thing: What is your version of PHP?
First think I would suspect is some PHP bugs.

pvanderspek’s picture

According to PHPInfo:
Apache/1.3.37 (Unix) PHP/5.2.9 mod_ssl/2.8.28 OpenSSL/0.9.8a mod_perl/1.29 FrontPage/5.0.2.2510

pvanderspek’s picture

Status: Fixed » Active
arlinsandbulte’s picture

Status: Active » Postponed (maintainer needs more info)

Ping: any update?
Just checking to see if there has been any progress and if this can be closed out....

pvanderspek’s picture

Status: Postponed (maintainer needs more info) » Active

This is still a problem. I haven't found the source of the problem, let alone a solution.

arlinsandbulte’s picture

Component: Date CCK Field » Code
Status: Active » Closed (won't fix)

Hi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.

Thanks.