Please feel free to let me know if you think this belongs in Views rather than here.

I'm creating an event calendar.

I have a content type called "Event" and a content type called "Library".

Libraries have locations.
Events have either a library (via an entity relationship) or a location of their own (some events don't happen at libraries).

I need to filter my View, which collects Events, by the event location (specifically by county).

In some cases, the location is coming from a field in the referenced Library, via a Views relationship.
In other cases, the location is a field in the Event itself.

I can filter either on the library location (via a relationship) or on the Event's own location, but I need both - I need the user to select a county and see all events in that county, whether they're at a library or not.

My problem is, I can't create a single exposed filter to operate on locations that may be coming from two different sources.

Do I need to somehow pull the library location into the Event, so that all Events have locations, whether or not they're at a library?

Comments

ahillio’s picture

Have you tried filter groups? http://nodeone.se/sv/node/678 gives video overview of filter groups. Not sure how they'd work with exposed filters though.

I'd probably setup the Library as a type of "Location" (perhaps Library as a term in "Location Type" vocabulary) and then have each Event node reference a Location node and some of those nodes would be libraries others not. That way the filtering is simplified. But there are probably ways to do it with your current structure. I wonder if filter groups would do it...

Sam Moore’s picture

Good thought, firestick - but it's not quite there.

When I tried grouping a filter on the Event's County field with a similar filter on the Location's County field, using OR, not only did it not return any data at all (almost as if it was set to AND), but it also exposed both filters. Needless to say this would be confusing to users.

I think what I'm going to do is require a County field on every event, even ones that are at Libraries, and try to find a way to programatically populate that field for events that are at libraries, from the Library's location.
At least then I can have one filter operating on one field.
I may have to make a hash table so that when jQuery detects the selection of library for an event, it can then figure out what county that library's in and insert the value.

Unless there's a way to bring the County field from the referenced Library entity into the Add page for an Event...

ahillio’s picture

suspected filter groups would not suffice. wish I could help. your way is cooler for sure :)

Sam Moore’s picture

Filter groups do look promising for other stuff - thanks for your help.
Cheers