0
votes

I've a problem with a complex query. I've a node type Event and the list of users. Between events and users may exists (or may not) RSVP relations created with the Relation module (https://www.drupal.org/project/relation). Inside any relation there are infos about the RSVP (presence, invites, ecc.). I need to make a page where I show next events with related RSVP informations about current logged user. I won't cover event filtering problem, the main problem is that not every event<->user has an RSVP relation, but only where the users has been interested about the event (why is obvious).

My incomplete solution was: starting from event list, filter only events which I'm interested in, create a relation "node<->RSVP relation" for get RSVP relation's fields, from previous relation, create a new relation "RSVP relation<->user" to get the linked user filter only user that is the currently logged in

This solution works only if the event<->current user RSVP relation exists! If it doesn't exist the event disappear where I want to show it without any RSVP informations.

My last idea of solution goes in direction of a filter applied only on relations and not to events, or the possibility to make two views (events and current user's RSVPs) and left join them. My old idea was to accept (I don't know how) also events without an event<->current user relation, but I realized that this solution may accepts all event<->!current user relations and I don't want this.

How can I do? Thank you!

2
An other solution that I've thinked is to build a relation to an other View. Explain: I build a second View "All RSVP from user %" that take an uid from a contextual filter and return the list of RSVPs and RSVP's events for that user, so i create a relation (left join) from the original view (the nid of the event) and the secondary view (the nid of the event from the RSVP). This would work, but I don't know how to do this.tmm360

2 Answers

0
votes

You should start checking if you set relationship as required. The difference will be an inner join instead of left join. Check the query to see what join are you getting

0
votes

At the end I've solved with the Drupal's module Views Field View with which I've included a View that selects RSVP informations inside an other View that list events