1

How can I create a view that contains events and news and filters on the event date if the content is event, and the expiration date if the content is news?

I dont see where to choose both simultaneously in the filter criteria.

2

You can go to 'Filter Criteria' and hit the triangle next to 'Add'. Select 'and/or, rearange' and you can change to OR instead of AND as well as add groups.

  • +1. I agree. The filter is: (content type == event AND event date OPERATOR CONDITION) OR (content type == news AND expiration date OPERATOR CONDITION) – J. Reynolds Jan 14 '15 at 5:22
0

The business logic you are asking for is usually accomplished by 2 sql queries. You will want to use 2 Views Attachments or an sql union of 2 views results to generate the resultset you want from a visitors selected criteria. There are modules to join 2 views, or views attachments is a functionality of Views (core).

For the UI to appear as you want (a single Date selection widget) shared across the 2 Views you want to create a single Views Global Filter to use between these 2 Views (your site may require additional global filters, but thats up to you).

From the project page:

Use Views Global Filter on sites that feature multiple Views. You want the views to be driven by the same filter selection, for instance a country, a date range, a search term or even proximity to a post code. These views may be on the same page or scattered across several pages on your site, however you want to offer the visitor the convenience of setting the filter for all these views only once, for instance when they first land on your site. Views Global Filter implements the picked once, operates site-wide (POOS) principle. This means you can place anywhere on your site a selection widget (drop-down, check boxes etc) to globally filter all or some of your views. When the user picks a value from the global selector, the value is invisibly passed as a contextual filter to whatever views you like, even when these reside across multiple pages. This avoids you having to duplicate filters and avoids the visitor having to re-select their choice as they go from page to page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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