Answers.Body: <p>Our need was for class rosters which included the one or two adults approved to pick up the child from class.</p>
  
  <p>The result is a list which displays a child's info on the same line as the adult(s) approved for pick up.</p>
  
  <p>For this solution <strong>we actually needed two views</strong>; View A shows the adults and is embedded into View B which lists the kids, using the contact ID from each of View B's kids to connect to the adults.  The key to this working is the Drupal module <a href="https://www.drupal.org/project/views_field_view" rel="nofollow">Views Field View</a>.  This allows us to insert a View into another view as a Field.</p>
  
  <p><strong>===== View A "Picked Up By" (type: CiviCRM Contacts) =====</strong></p>
  
  <p><strong><em>Format:</em></strong> Delimited text list (from the Drupal module <a href="https://www.drupal.org/project/views_delimited_list" rel="nofollow">Views Delimited List</a>; this module is key because it allows us to insert the text OR into the result: "Adult A OR Adult B" and get both adults on the same line)</p>
  
  <p><strong><em>Under Advanced > Relationships</em></strong></p>
  
  <p>We use 2 relationships to list the adults:</p>
  
  <ol>
  <li><p>CiviCRM Contacts: CiviCRM Relationship (starting from Contact A)</p>
  
  <p>~ Specific relationship type: Picked up by | Primary Pickup for (you could certainly use Parent | Child here)</p>
  
  <p>~ Limit results only to active relationships</p></li>
  <li><p>CiviCRM Relationship : Contact ID B</p>
  
  <p>~ Relationship: the relationship you just setup, CiviCRM Relationship (starting from Contact A)</p>
  
  <p>~ Identifier: CiviCRM Contact B</p></li>
  </ol>
  
  <p><strong><em>Under Advanced > Contextual Filters</em></strong></p>
  
  <p>CiviCRM Contacts: Contact ID</p>
  
  <ul>
  <li>Do not use a relationship (if it forces you to use a relationship, then delete the relationships, create this contextual filter first, then create the relationships)</li>
  <li>When the filter value is NOT available, Hide view</li>
  <li><p>Specify validation criteria</p>
  
  <p>-- Validator: Basic Validation</p>
  
  <p>-- Action to take... : Hide view</p></li>
  </ul>
  
  <p><strong><em>Fields</em></strong></p>
  
  <ul>
  <li>CiviCRM Contacts: First Name (using Relationship 2 - CiviCRM Contact B)</li>
  </ul>
  
  <p><strong><em>Filter Criteria</em></strong></p>
  
  <ul>
  <li>CiviCRM Contacts: Is Deleted - False (using Relationship 2 - CiviCRM Contact B)</li>
  </ul>
  
  <p><strong><em>Summary of how this works:</em></strong>
  The contextual filter takes the contact ID for the child (which will be supplied by the second view) and uses that as the contact ID for the first relationship.  Then, the second relationship gets us to the adult as the Contact B of the Child/Adult relationship.  Then you display the Name of the adult (and make sure that the adult hasn't been deleted with the filter criteria).</p>
  
  <p><strong>===== View B "Rosters" (type: CiviCRM Contacts) =====</strong></p>
  
  <p><strong><em>Format:</em></strong> Table</p>
  
  <p>No contextual filters or relationships needed</p>
  
  <p><strong><em>Fields</em></strong></p>
  
  <ul>
  <li>CiviCRM Contacts: Contact ID (this can be excluded from display, but needed later)</li>
  <li>Child's Name (we use Sort Name)</li>
  <li>Any other info you need for your kids</li>
  <li>Here's the all important field supplied from the Views Field View module: View: Include View</li>
  </ul>
  
  <p>For this field, you select which other view (View A) you would like to embed into this view (View B).  So, for View to include, you select View A ("Picked_up_by" in our case).  For number of arguments, 1.  For Argument #1, you use: [id] which is the contact id from the field you excluded from display above.</p>
  
  <p><strong><em>Filter Criteria</em></strong>
  Filter the contacts in View B such that only the children you need listed are displayed, whether that is by tag (how we do it) or group or custom field.</p>
  
  <p>This will also work with exposed filters as our rosters are divided up by a custom field "Grade" so we have an exposed filter on View B which allows us to select which Grade level we want to look at.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-04T01:58:03.690Z
Answers.Text: Wow, this is really complex, but also seems like a great workaround. I will give it a try and let you know how it goes!
Answers.UserDisplayName: naomisl
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-09T00:40:37.937Z
Answers.Text: ..and it works! Thank you so much! Some notes: If instead of "OR" you add the html "</td><td>" your inline fields will be separate cells in the table. If you do this, those fields must be placed on the end, because they will overwrite other cells. Also, if you are in Drupal 7 and Views Field View 7.x-1.1, instead of arguments there are contextual filters, and you use the token  [!id].
Answers.UserDisplayName: naomisl
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-09T02:55:29.833Z
Answers.Text: Glad it worked for you! Happy to help.
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-04T00:02:41.367Z
Answers.LastActivityDate: 2015-09-04T00:02:41.367Z
Answers.UserDisplayName: Allen Hutchison
Answers.Body: <p>I will add this as an answer so i can add the screenshot. You 'should' be able to filter by Groups in a civicrm contact based View. In the screenshot you will see i have both Group Name and Group ID set as fields, and have Group ID set as an Exposed Filter. Hope that helps if only to confirm that something is amiss in the world of Views for you. </p>
  
  <p><a href="https://i.sstatic.net/as8GE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/as8GE.png" alt="enter image description here"></a>(Note: on the first site i went to do this on I also did not have them available, but that is a Pantheon based site where things keep changing on me, on the second which is a standard-hosted site it all worked as expected. So you may not be alone with the Group fields being unavailable)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-03T17:50:16.927Z
Answers.Text: Thank you petednz! I'm going to see about exposing that option and report back.
Answers.UserDisplayName: naomisl
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-03T19:24:40.820Z
Answers.Text: This seems to work only if exposed, but that's workable. Thank you!
Answers.UserDisplayName: naomisl
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-04T02:20:36.750Z
Answers.Text: really? are you saying that if you 'apply' the filter and use the Group ID, but do not set it to be Exposed, then the filter does not work? If so that is a bug that needs fixing.
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-08T19:22:10.293Z
Answers.Text: Yes, that was my experience. I will see if I can recreate the issue, and if so report it as a bug. I'm not completely confident I wasn't doing something else wrong somehow, so I'm going to check first.
Answers.UserDisplayName: naomisl
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-03T03:30:09.553Z
Answers.LastActivityDate: 2015-09-03T03:30:09.553Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>I have managed to cobble together a view that mostly works:</p>
  
  <p>go to admin/structure/views
  click "add new view"
  Show: civicrm contacts
  Display Format: Table
  fill out the rest of the fields as you like, then click "continue and edit"</p>
  
  <p>In the view editor, click "advanced"
  under relationships, add the following:</p>
  
  <p>CiviCRM Contacts: CiviCRM Relationship (starting from contact A)
  Choose the type of relationship you want. I chose Parent/child.</p>
  
  <p>(CiviCRM Relationship (starting from contact A)) CiviCRM Relationships: Contact ID A
  Select "starting from contact A"
  Name this contact. I named it "child"</p>
  
  <p>(CiviCRM Relationship (starting from contact A)) CiviCRM Relationships: Contact ID B
  Select "starting from contact A"
  Name this contact. I named it "parent."</p>
  
  <p>Now that the relationships are in place, you can add your fields. for example, add a field "civicrm contacts: display name." it will give you the option to use a relationship. choose "child" from the drop down menu. Make sure to change the label to reflect what you've done.
  Then you can do the same thing again but this time pick "parent."</p>
  
  <p>You will see a table that displays like so (please excuse my inability to create a table here):</p>
  
  <p>Child Name | Parent Name</p>
  
  <hr>
  
  <p>Tom Jones Jr |  Tom Jones, Sr</p>
  
  <hr>
  
  <p>Tom Jones Jr |  Tabitha Jones</p>
  
  <p>As you can see, the issue with this solution is that when a single child has two (or more) parents, that student is listed twice. If anyone has a solution to that issue, I'd be most grateful to have it. In an ideal world, the output would be as follows:</p>
  
  <p>Child Name   |  Parent Name   |  Parent Name</p>
  
  <hr>
  
  <p>Tom Jones Jr |  Tom Jones, Sr | Tabitha Jones</p>
  
  <hr>
  
  <p>I haven't yet reached that ideal state, but what I have does pull what I need, data-wise. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-17T23:43:32.973Z
Answers.Text: @AllenHutchison did you ever post your solution for this issue? We have a client that is looking for this functionality, we're in the process of deciding if a Drupal View would work or if we should create a custom report or search for them.
Answers.UserDisplayName: Evan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-18T19:24:25.937Z
Answers.Text: @Evan, yes, please see the selected answer (green check mark) to the question.
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-03T04:16:00.410Z
Answers.Text: naomisl, we are in the same boat and did find a solution!  I will post it tomorrow from work.  It results in "Child Info | Parent Name or Parent Name".
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-03T17:49:29.667Z
Answers.Text: Allen, I would love to see that result! Thank you for sharing.
Answers.UserDisplayName: naomisl
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-03T01:55:29.460Z
Answers.LastActivityDate: 2015-09-03T01:55:29.460Z
Answers.UserDisplayName: naomisl
Body: <p>I would like to create a view, or custom report, whoever is easier, to show the following:
  -The names of all contacts in a specific group
  -Some of their contact information
  -The names of all contacts in specific relationships with them (parent-child, for example)
  -Some of the contact information of the above. </p>
  
  <p>When I created a view, I wasn't able to filter by group membership. And when I went to create a report I wasn't sure where to get started. Got any tips for me?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-03T01:04:40.580Z
Comments.Text: What prevented you using 'group' as a filter. Is it a Smart Group?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-03T01:56:55.740Z
Comments.Text: No, not a smart group. I simply see no option for groups under filter. I went around this by saying the relationship I describe below was required, but actually did not solve this part of my question yet.
Comments.UserDisplayName: naomisl
Tags: <civireport><drupal-views><custom-search><custom-reports>
Title: How should I generate a report (or view) showing contacts and people they have relationships to?
ThreadText: # How should I generate a report (or view) showing contacts and people they have relationships to?
  
  (Asked by: username_0 on 2015-09-02)
  
  I would like to create a view, or custom report, whoever is easier, to show the following:
  -The names of all contacts in a specific group
  -Some of their contact information
  -The names of all contacts in specific relationships with them (parent-child, for example)
  -Some of the contact information of the above.
  
  When I created a view, I wasn't able to filter by group membership. And when I went to create a report I wasn't sure where to get started. Got any tips for me?
  
  **Tags:** civireport, drupal-views, custom-search, custom-reports
  
  > **Comments:**
  > **username_1**: What prevented you using 'group' as a filter. Is it a Smart Group?  
  > **username_0**: No, not a smart group. I simply see no option for groups under filter. I went around this by saying the relationship I describe below was required, but actually did not solve this part of my question yet.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2015-09-04. Score: 2 | Accepted answer
  
  Our need was for class rosters which included the one or two adults approved to pick up the child from class.
  
  The result is a list which displays a child's info on the same line as the adult(s) approved for pick up.
  
  For this solution **we actually needed two views**; View A shows the adults and is embedded into View B which lists the kids, using the contact ID from each of View B's kids to connect to the adults. The key to this working is the Drupal module [Views Field View](https://www.drupal.org/project/views_field_view). This allows us to insert a View into another view as a Field.
  
  **===== View A "Picked Up By" (type: CiviCRM Contacts) =====**
  
  ***Format:*** Delimited text list (from the Drupal module [Views Delimited List](https://www.drupal.org/project/views_delimited_list); this module is key because it allows us to insert the text OR into the result: "Adult A OR Adult B" and get both adults on the same line)
  
  ***Under Advanced > Relationships***
  
  We use 2 relationships to list the adults:
  
  1. CiviCRM Contacts: CiviCRM Relationship (starting from Contact A)
  
     ~ Specific relationship type: Picked up by | Primary Pickup for (you could certainly use Parent | Child here)
  
     ~ Limit results only to active relationships
  2. CiviCRM Relationship : Contact ID B
  
     ~ Relationship: the relationship you just setup, CiviCRM Relationship (starting from Contact A)
  
     ~ Identifier: CiviCRM Contact B
  
  ***Under Advanced > Contextual Filters***
  
  CiviCRM Contacts: Contact ID
  
  * Do not use a relationship (if it forces you to use a relationship, then delete the relationships, create this contextual filter first, then create the relationships)
  * When the filter value is NOT available, Hide view
  * Specify validation criteria
  
    -- Validator: Basic Validation
  
    -- Action to take... : Hide view
  
  ***Fields***
  
  * CiviCRM Contacts: First Name (using Relationship 2 - CiviCRM Contact B)
  
  ***Filter Criteria***
  
  * CiviCRM Contacts: Is Deleted - False (using Relationship 2 - CiviCRM Contact B)
  
  ***Summary of how this works:***
  The contextual filter takes the contact ID for the child (which will be supplied by the second view) and uses that as the contact ID for the first relationship. Then, the second relationship gets us to the adult as the Contact B of the Child/Adult relationship. Then you display the Name of the adult (and make sure that the adult hasn't been deleted with the filter criteria).
  
  **===== View B "Rosters" (type: CiviCRM Contacts) =====**
  
  ***Format:*** Table
  
  No contextual filters or relationships needed
  
  ***Fields***
  
  * CiviCRM Contacts: Contact ID (this can be excluded from display, but needed later)
  * Child's Name (we use Sort Name)
  * Any other info you need for your kids
  * Here's the all important field supplied from the Views Field View module: View: Include View
  
  For this field, you select which other view (View A) you would like to embed into this view (View B). So, for View to include, you select View A ("Picked\_up\_by" in our case). For number of arguments, 1. For Argument #1, you use: [id] which is the contact id from the field you excluded from display above.
  
  ***Filter Criteria***
  Filter the contacts in View B such that only the children you need listed are displayed, whether that is by tag (how we do it) or group or custom field.
  
  This will also work with exposed filters as our rosters are divided up by a custom field "Grade" so we have an exposed filter on View B which allows us to select which Grade level we want to look at.
  
  > **Comments:**
  > **username_0**: Wow, this is really complex, but also seems like a great workaround. I will give it a try and let you know how it goes!  
  > **username_0**: ..and it works! Thank you so much! Some notes: If instead of "OR" you add the html "</td><td>" your inline fields will be separate cells in the table. If you do this, those fields must be placed on the end, because they will overwrite other cells. Also, if you are in Drupal 7 and Views Field View 7.x-1.1, instead of arguments there are contextual filters, and you use the token  [!id].  
  > **username_2**: Glad it worked for you! Happy to help.  
  
  ---
  
  ### Answer by username_1 on 2015-09-03. Score: 2
  
  I will add this as an answer so i can add the screenshot. You 'should' be able to filter by Groups in a civicrm contact based View. In the screenshot you will see i have both Group Name and Group ID set as fields, and have Group ID set as an Exposed Filter. Hope that helps if only to confirm that something is amiss in the world of Views for you.
  
  [![enter image description here](https://i.sstatic.net/as8GE.png)](https://i.sstatic.net/as8GE.png)(Note: on the first site i went to do this on I also did not have them available, but that is a Pantheon based site where things keep changing on me, on the second which is a standard-hosted site it all worked as expected. So you may not be alone with the Group fields being unavailable)
  
  > **Comments:**
  > **username_0**: Thank you username_1! I'm going to see about exposing that option and report back.  
  > **username_0**: This seems to work only if exposed, but that's workable. Thank you!  
  > **username_1**: really? are you saying that if you 'apply' the filter and use the Group ID, but do not set it to be Exposed, then the filter does not work? If so that is a bug that needs fixing.  
  > **username_0**: Yes, that was my experience. I will see if I can recreate the issue, and if so report it as a bug. I'm not completely confident I wasn't doing something else wrong somehow, so I'm going to check first.  
  
  ---
  
  ### Answer by username_0 on 2015-09-03. Score: 1
  
  I have managed to cobble together a view that mostly works:
  
  go to admin/structure/views
  click "add new view"
  Show: civicrm contacts
  Display Format: Table
  fill out the rest of the fields as you like, then click "continue and edit"
  
  In the view editor, click "advanced"
  under relationships, add the following:
  
  CiviCRM Contacts: CiviCRM Relationship (starting from contact A)
  Choose the type of relationship you want. I chose Parent/child.
  
  (CiviCRM Relationship (starting from contact A)) CiviCRM Relationships: Contact ID A
  Select "starting from contact A"
  Name this contact. I named it "child"
  
  (CiviCRM Relationship (starting from contact A)) CiviCRM Relationships: Contact ID B
  Select "starting from contact A"
  Name this contact. I named it "parent."
  
  Now that the relationships are in place, you can add your fields. for example, add a field "civicrm contacts: display name." it will give you the option to use a relationship. choose "child" from the drop down menu. Make sure to change the label to reflect what you've done.
  Then you can do the same thing again but this time pick "parent."
  
  You will see a table that displays like so (please excuse my inability to create a table here):
  
  Child Name | Parent Name
  
  ---
  
  Tom Jones Jr | Tom Jones, Sr
  
  ---
  
  Tom Jones Jr | Tabitha Jones
  
  As you can see, the issue with this solution is that when a single child has two (or more) parents, that student is listed twice. If anyone has a solution to that issue, I'd be most grateful to have it. In an ideal world, the output would be as follows:
  
  Child Name | Parent Name | Parent Name
  
  ---
  
  Tom Jones Jr | Tom Jones, Sr | Tabitha Jones
  
  ---
  
  I haven't yet reached that ideal state, but what I have does pull what I need, data-wise.
  
  > **Comments:**
  > **username_2**: username_0, we are in the same boat and did find a solution!  I will post it tomorrow from work.  It results in "Child Info | Parent Name or Parent Name".  
  > **username_0**: username_2, I would love to see that result! Thank you for sharing.  
  > **username_3**: @username_2 did you ever post your solution for this issue? We have a client that is looking for this functionality, we're in the process of deciding if a Drupal View would work or if we should create a custom report or search for them.  
  > **username_2**: @username_3, yes, please see the selected answer (green check mark) to the question.  
  
  ---
  
  