I am non-technical and my site is a hobby so please bear with me!

I have a table of wildlife sighting records [species/location/date/recorder] and I want to display how many records there are for a selected species in each month. I am using Drupal 7 and utilising the Views (with aggregation on) and Charts module; doing this I can read all the records and display how many records there are for all species per month - no problem (www.natureofdorset.co.uk - see chart at the bottom of the page].

My problem comes when I submit a contextual filter for a given species. This, of course, then reduces the sightings tables records to only those for that species and so only produces bars for the months in which a species has been seen whereas I want to show also any month where it has no records (ie: not seen).

I guess any solution using a contextual filter is going to give me this problem unless there is a setting somewhere in views to overcome this? I cannot write my own module as I cannot write any code so can anyone suggest a way of doing this, may be I am using the wrong modules?

Grateful thanks to anyone who can help!

Comments

John_B’s picture

You need to get the 'no results behaviour' working. I looked at your site and am not sure what part of the page is outputted by Charts, which I have not used, as I do not see a chart there. However, I would be inclined to get the 'no results behaviour' working on a Views display which does not use Charts, but is otherwise identical, such as a table, and once it is clear you have some suitable output from Views, then check whether there is still a problem with the chart. The following post may help with 'no results behaviour': https://drupal.stackexchange.com/questions/109465/views-no-results-text-...

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

natureofdorset’s picture

Firstly - sorry for the incomplete URL, the chart appears here: http://www.natureofdorset.co.uk/records-menu - this shows all the records for all species. If you then look at http://www.natureofdorset.co.uk/record-species-page/Adder and you will see records for Feb, Mar and Apr and I want Jan to show as well with 0 records shown.

Secondly, thanks for the info on 'no results behaviour'; it is not something I have encountered before. I have tried following the example on the link you sent me:

Display all results for the specified field

Specify validation criteria

Validator = basic validation

Action to take if filter value does not validate = Display all results for the specified field

This makes no difference, Jan is still missing so I guess I have to use different values than in the example as I am trying to do something different?

I have done as you suggested and tried it on a able and I get the same - records for all species on the main page and records for just the moths with records on the sub-page so it is the structure of the view that needs correcting and is not a problem with charts.

If you have any further suggestions at what the correct settings might be I would be very grateful, otherwise I will have to resort to trial and error!

John_B’s picture

No quick solution really. Some people have run into the 'no results behaviour' returning nothing when the View depends on an exposed filter set to 'input required' https://www.drupal.org/node/1147384. Not sure whether this can be relevant, though building a complex query with views can be a bit of black art requiring trial and error. Getting no results to return a zero (0 as integer) would be nice.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

natureofdorset’s picture

OK thanks for trying. I have no exposed filters so that is not the problem. At least you have given me something to work on, I will try various options tomorrow.