I have three content types: patient, patient medication, and physician.

Using the Node Reference module, patient medication references the patient content type and the physician content type. How can I create a view with a contextual filter that does the following: When I view a physician node, I want to view all patients that the physician has interacted with. Using the two Node Reference fields in the patient medication content type, how can I display a block of unique patients that the physician has prescribed a medication to?

I basically have it set up like a relational table: Patient <-- Patient Medication --> Physician (The arrows represent the node reference)

2 Answers 2


Create a view of content type Physician and set relationship between Patient --- Patient Medication & Patient Medication --- Physician keep both relationship required. Now add all field related with Patient nodes. Here only a block display with patient and Patient Medication.

  • Thanks for the reply, can you clarify what you mean by set a relationship between patient -- Patient Medication & Patient Medication -- Physician? When I try to add a relationship to the view, I can only add one field. Commented Sep 24, 2015 at 17:33
  • You can add multiple relationship ,one-by-one Commented Sep 24, 2015 at 17:43

Let's suppose that that's your Patient Medication structure:

  • Title
  • Patient (field_ref_patient) (node reference to Patient content type)
  • Physician (field_ref_physician) (node reference to Physician content type)

So, let's make a view with these settings:


  • Patient (field_ref_patient) (Relation: Patient)


  • Physician (field_ref_physician) (The reverse version)

Contextual Filters

  • Content NID (Default value: Content ID from URL)

This might give you the patients of Patient Medication where Physician is the node that you are viewing

I created an example here: http://dfjfp.ply.st/ (you have 24 hours to check it until it die), go to Structure > Views > Physician and give it a node ID, in my example the ID is 3, that id belongs to the Patient Medication that i created.

  • So? did you tried that idea?
    – xstean
    Commented Oct 27, 2015 at 14:43

Your Answer

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

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