0

I have a date field attached to a content type and it's not a required field. I want to use this date to control the display of the content using a view and it's filter criteria.

Some content may have blank dates and some may have a start and end date.

Is there a way I can set up the view to check for all of these conditions?

  • content is published
  • AND content type is TYPE
  • AND Start date is blank OR Start date is not blank AND start date is <= NOW
  • AND End date is blank OR End date is not blank AND end date >= NOW

1 Answer 1

2

The conditions I had set above were too many

  • content is published
  • AND content type is TYPE
  • AND Start date is blank OR Start date is not blank AND start date is <= NOW
  • AND End date is blank OR End date is not blank AND end date >= NOW

and should have been:

  • content is published
  • AND content type is TYPE
  • AND Start date is blank OR start date is <= NOW
  • AND End date is blank OR end date >= NOW

because the NOT blank is implied.

Using the 'And/Or, Rearrange' feature of the Filter Criteria, I was able to create 3 groups joined by AND's with Group 2 and 3 joined by OR's. Like so:

enter image description here

4
  • What settings did you use to check for a blank date? I don't see an "is empty" operator in the date filter?
    – Giles B
    Sep 11, 2015 at 0:07
  • Content Offer Dates - start date and Content Offer Dates - end date:value2 are the conditions that check for empty. Sep 11, 2015 at 12:54
  • Thanks for response! Turns out I was using the Date filter (which does not have an empty option) instead of the regular field filter.
    – Giles B
    Sep 13, 2015 at 21:02
  • Giles: Built-in date fields like "User: Last Access" don't have field counterparts, so for those instances I was able to use Date: is not between MIN: 1000-01-01 / MAX: 3000-01-01 which successfully shows me all users who have never access the site.
    – atwixtor
    Nov 16, 2015 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.