Answers.Body: <p>We have managed to solve a similar scenario with the help of <a href="https://www.drupal.org/project/views_field_view" rel="nofollow noreferrer">Views Field View</a> extension. It's a bit laborious but you can define a (secundary) 'contact view' with the desired fields and then a (primary) 'participant view' with desired participant fields and the 'contact view' as a view field. You need to add a contextual filter on the participant view with the contact ID. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-22T10:36:26.017Z
Answers.Text: I am testing this solution, but I have some problems : an AJAX error (https://civicrm.stackexchange.com/questions/33132/views-field-view-ajax-error) ; However, Include View seems to work, but is not really satisfactory ; but the AJAX error with Append View seems too important to have it working. Are you aware of that ?
Answers.UserDisplayName: Jacques-Marie Moranne
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-04T12:36:28.347Z
Answers.LastActivityDate: 2018-12-04T12:36:28.347Z
Answers.UserDisplayName: Francesc Bassas i Bullich
Answers.Body: <p>You should be able to achieve what is required by creating a CiviCRM Participants view and using the CiviCRM Participants: Participant's Contact ID as a relationship to bring in contact custom data –</p>
  
  <p><a href="https://i.sstatic.net/3fvch.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3fvch.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.sstatic.net/G52CJ.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/G52CJ.jpg" alt="enter image description here"></a></p>
  
  <p>Or import the belew view (I've removed custom data so this needs to be added yourself) -</p>
  
  <p>$view = new view();
  $view->name = 'individual_and_participant_view';
  $view->description = '';
  $view->tag = 'default';
  $view->base_table = 'civicrm_participant';
  $view->human_name = 'Individual and participant view';
  $view->core = 7;
  $view->api_version = '3.0';
  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */</p>
  
  <p>/* Display: Master <em>/
  $handler = $view->new_display('default', 'Master', 'default');
  $handler->display->display_options['title'] = 'Individual and participant view';
  $handler->display->display_options['use_more_always'] = FALSE;
  $handler->display->display_options['access']['type'] = 'none';
  $handler->display->display_options['cache']['type'] = 'none';
  $handler->display->display_options['query']['type'] = 'views_query';
  $handler->display->display_options['exposed_form']['type'] = 'basic';
  $handler->display->display_options['pager']['type'] = 'full';
  $handler->display->display_options['pager']['options']['items_per_page'] = '100';
  $handler->display->display_options['pager']['options']['offset'] = '0';
  $handler->display->display_options['pager']['options']['id'] = '0';
  $handler->display->display_options['pager']['options']['quantity'] = '9';
  $handler->display->display_options['style_plugin'] = 'table';
  $handler->display->display_options['style_options']['columns'] = array(
    'id' => 'id',
    'display_name' => 'display_name',
  );
  $handler->display->display_options['style_options']['default'] = '-1';
  $handler->display->display_options['style_options']['info'] = array(
    'id' => array(
      'sortable' => 0,
      'default_sort_order' => 'asc',
      'align' => '',
      'separator' => '',
      'empty_column' => 0,
    ),
    'display_name' => array(
      'sortable' => 0,
      'default_sort_order' => 'asc',
      'align' => '',
      'separator' => '',
      'empty_column' => 0,
    ),
  );
  /</em> Relationship: CiviCRM Participants: Participant's Contact ID <em>/
  $handler->display->display_options['relationships']['contact_id_1']['id'] = 'contact_id_1';
  $handler->display->display_options['relationships']['contact_id_1']['table'] = 'civicrm_participant';
  $handler->display->display_options['relationships']['contact_id_1']['field'] = 'contact_id';
  /</em> Field: CiviCRM Events: Title <em>/
  $handler->display->display_options['fields']['title']['id'] = 'title';
  $handler->display->display_options['fields']['title']['table'] = 'civicrm_event';
  $handler->display->display_options['fields']['title']['field'] = 'title';
  /</em> Field: CiviCRM Contacts: Display Name */
  $handler->display->display_options['fields']['display_name']['id'] = 'display_name';
  $handler->display->display_options['fields']['display_name']['table'] = 'civicrm_contact';
  $handler->display->display_options['fields']['display_name']['field'] = 'display_name';
  $handler->display->display_options['fields']['display_name']['link_to_civicrm_contact'] = 0;</p>
  
  <p>/* Display: Page */
  $handler = $view->new_display('page', 'Page', 'page');
  $handler->display->display_options['path'] = 'individual-and-participant-view';</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-05T13:49:56.637Z
Answers.Text: Thanks a lot, Anil ; I used a Relationship with Contribution's Contact ID instead of Participant's Contact ID : it brought the Contacts custom fields in the play and I could select them but they were not populated. Including Participant's relationship instead works fine. Happy to accept your answer !
Answers.UserDisplayName: Jacques-Marie Moranne
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-04T14:42:34.077Z
Answers.LastActivityDate: 2018-12-04T14:42:34.077Z
Answers.UserDisplayName: Anil
Body: <p>I want to create a View :</p>
  
  <ul>
  <li>which displays some Individuals Custom Data (e.g. Passport information)</li>
  <li>where Individuals are filtered according to their Participation to an Event (id=20)</li>
  </ul>
  
  <p>I imagine 3 different ways to do that but none of them is working :</p>
  
  <ol>
  <li>Create a Contact oriented View and filter via some civicrm_participant fields but the civicrm_participant table (and fields) is not accessible for filtering :<a href="https://i.sstatic.net/Lhlps.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Lhlps.png" alt="enter image description here"></a></li>
  <li>Create a Participant oriented View ans add some Individual Custom Fields : but in this case, the custom fields are not populated though I was able to add them :<a href="https://i.sstatic.net/8v5P1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8v5P1.png" alt="enter image description here"></a></li>
  <li>Create a Smart Group based upon the Participants, and then filter the Contact View on this Smart Group, but Views does not seem to consider Smart Groups, but only Static groups</li>
  </ol>
  
  <p>Of course, I checked that my custom field tables are included in settings</p>
  
  <p>Clearing the caches has no effect</p>
  
  <p>How can I solve my problem ? (civicrm 5.6.0 / Drupal 7.60)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-25T19:20:21.717Z
Comments.Text: Are you using Views 'Relationships' in adding the custom fields?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-25T19:21:54.993Z
Comments.Text: Also are you using Contact Sub-Types or Event Sub-types
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-26T08:01:39.663Z
Comments.Text: I use Views Relationships (Contributions) in the Participant View to have the Individual Custom Fields (as far as I remember this was Eileen's advice) ... and I have them available in the "Add" or "Filter" fields, but not populated.
Comments.UserDisplayName: Jacques-Marie Moranne
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-26T08:05:19.333Z
Comments.Text: I actually use Individual Sub-Types to distinguish Children and Adults : shoudn't I ? Can it be the cause ? I can, of course, replace sub-types by a Tag or a custom field : would you ?
Comments.UserDisplayName: Jacques-Marie Moranne
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-26T13:44:01.787Z
Comments.Text: I have just removed the sub-type of a test (Participant) Contact : no change
Comments.UserDisplayName: Jacques-Marie Moranne
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-26T18:54:50.450Z
Comments.Text: so the custom fields were not specific to the sub-type?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-27T06:28:48.220Z
Comments.Text: No, the custom fields group is related to Individual/All sub-types
Comments.UserDisplayName: Jacques-Marie Moranne
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-27T06:42:33.473Z
Comments.Text: See also my comment, next to JohnFF's there : https://civicrm.stackexchange.com/questions/17405/how-to-create-drupal-view-of-participants-with-custom-fields/27476#27476
Comments.UserDisplayName: Jacques-Marie Moranne
Tags: <drupal-views>
Title: How to display Individual Custom Fields in a Participants View
ThreadText: # How to display Individual Custom Fields in a Participants View
  
  (Asked by: username_0 on 2018-11-24)
  
  I want to create a View :
  
  * which displays some Individuals Custom Data (e.g. Passport information)
  * where Individuals are filtered according to their Participation to an Event (id=20)
  
  I imagine 3 different ways to do that but none of them is working :
  
  1. Create a Contact oriented View and filter via some civicrm\_participant fields but the civicrm\_participant table (and fields) is not accessible for filtering :[![enter image description here](https://i.sstatic.net/Lhlps.png)](https://i.sstatic.net/Lhlps.png)
  2. Create a Participant oriented View ans add some Individual Custom Fields : but in this case, the custom fields are not populated though I was able to add them :[![enter image description here](https://i.sstatic.net/8v5P1.png)](https://i.sstatic.net/8v5P1.png)
  3. Create a Smart Group based upon the Participants, and then filter the Contact View on this Smart Group, but Views does not seem to consider Smart Groups, but only Static groups
  
  Of course, I checked that my custom field tables are included in settings
  
  Clearing the caches has no effect
  
  How can I solve my problem ? (civicrm 5.6.0 / Drupal 7.60)
  
  **Tags:** drupal-views
  
  > **Comments:**
  > **username_1**: Are you using Views 'Relationships' in adding the custom fields?  
  > **username_1**: Also are you using Contact Sub-Types or Event Sub-types  
  > **username_0**: I use Views Relationships (Contributions) in the Participant View to have the Individual Custom Fields (as far as I remember this was Eileen's advice) ... and I have them available in the "Add" or "Filter" fields, but not populated.  
  > **username_0**: I actually use Individual Sub-Types to distinguish Children and Adults : shoudn't I ? Can it be the cause ? I can, of course, replace sub-types by a Tag or a custom field : would you ?  
  > **username_0**: I have just removed the sub-type of a test (Participant) Contact : no change  
  > **username_1**: so the custom fields were not specific to the sub-type?  
  > **username_0**: No, the custom fields group is related to Individual/All sub-types  
  > **username_0**: See also my comment, next to JohnFF's there : https://civicrm.stackexchange.com/questions/17405/how-to-create-drupal-view-of-participants-with-custom-fields/27476#27476  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2018-12-04. Score: 3 | Accepted answer
  
  You should be able to achieve what is required by creating a CiviCRM Participants view and using the CiviCRM Participants: Participant's Contact ID as a relationship to bring in contact custom data –
  
  [![enter image description here](https://i.sstatic.net/3fvch.jpg)](https://i.sstatic.net/3fvch.jpg)
  
  [![enter image description here](https://i.sstatic.net/G52CJ.jpg)](https://i.sstatic.net/G52CJ.jpg)
  
  Or import the belew view (I've removed custom data so this needs to be added yourself) -
  
  $view = new view();
  $view->name = 'individual\_and\_participant\_view';
  $view->description = '';
  $view->tag = 'default';
  $view->base\_table = 'civicrm\_participant';
  $view->human\_name = 'Individual and participant view';
  $view->core = 7;
  $view->api\_version = '3.0';
  $view->disabled = FALSE; /\* Edit this to true to make a default view disabled initially \*/
  
  /\* Display: Master */
  $handler = $view->new\_display('default', 'Master', 'default');
  $handler->display->display\_options['title'] = 'Individual and participant view';
  $handler->display->display\_options['use\_more\_always'] = FALSE;
  $handler->display->display\_options['access']['type'] = 'none';
  $handler->display->display\_options['cache']['type'] = 'none';
  $handler->display->display\_options['query']['type'] = 'views\_query';
  $handler->display->display\_options['exposed\_form']['type'] = 'basic';
  $handler->display->display\_options['pager']['type'] = 'full';
  $handler->display->display\_options['pager']['options']['items\_per\_page'] = '100';
  $handler->display->display\_options['pager']['options']['offset'] = '0';
  $handler->display->display\_options['pager']['options']['id'] = '0';
  $handler->display->display\_options['pager']['options']['quantity'] = '9';
  $handler->display->display\_options['style\_plugin'] = 'table';
  $handler->display->display\_options['style\_options']['columns'] = array(
  'id' => 'id',
  'display\_name' => 'display\_name',
  );
  $handler->display->display\_options['style\_options']['default'] = '-1';
  $handler->display->display\_options['style\_options']['info'] = array(
  'id' => array(
  'sortable' => 0,
  'default\_sort\_order' => 'asc',
  'align' => '',
  'separator' => '',
  'empty\_column' => 0,
  ),
  'display\_name' => array(
  'sortable' => 0,
  'default\_sort\_order' => 'asc',
  'align' => '',
  'separator' => '',
  'empty\_column' => 0,
  ),
  );
  /* Relationship: CiviCRM Participants: Participant's Contact ID */
  $handler->display->display\_options['relationships']['contact\_id\_1']['id'] = 'contact\_id\_1';
  $handler->display->display\_options['relationships']['contact\_id\_1']['table'] = 'civicrm\_participant';
  $handler->display->display\_options['relationships']['contact\_id\_1']['field'] = 'contact\_id';
  /* Field: CiviCRM Events: Title */
  $handler->display->display\_options['fields']['title']['id'] = 'title';
  $handler->display->display\_options['fields']['title']['table'] = 'civicrm\_event';
  $handler->display->display\_options['fields']['title']['field'] = 'title';
  /* Field: CiviCRM Contacts: Display Name \*/
  $handler->display->display\_options['fields']['display\_name']['id'] = 'display\_name';
  $handler->display->display\_options['fields']['display\_name']['table'] = 'civicrm\_contact';
  $handler->display->display\_options['fields']['display\_name']['field'] = 'display\_name';
  $handler->display->display\_options['fields']['display\_name']['link\_to\_civicrm\_contact'] = 0;
  
  /\* Display: Page \*/
  $handler = $view->new\_display('page', 'Page', 'page');
  $handler->display->display\_options['path'] = 'individual-and-participant-view';
  
  > **Comments:**
  > **username_0**: Thanks a lot, username_3 ; I used a Relationship with Contribution's Contact ID instead of Participant's Contact ID : it brought the Contacts custom fields in the play and I could select them but they were not populated. Including Participant's relationship instead works fine. Happy to accept your answer !  
  
  ---
  
  ### Answer by username_2 on 2018-12-04. Score: 3
  
  We have managed to solve a similar scenario with the help of [Views Field View](https://www.drupal.org/project/views_field_view) extension. It's a bit laborious but you can define a (secundary) 'contact view' with the desired fields and then a (primary) 'participant view' with desired participant fields and the 'contact view' as a view field. You need to add a contextual filter on the participant view with the contact ID.
  
  > **Comments:**
  > **username_0**: I am testing this solution, but I have some problems : an AJAX error (https://civicrm.stackexchange.com/questions/33132/views-field-view-ajax-error) ; However, Include View seems to work, but is not really satisfactory ; but the AJAX error with Append View seems too important to have it working. Are you aware of that ?  
  
  ---
  
  