CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Displaying related contacts in a View
Pages: [1]

Author Topic: Displaying related contacts in a View  (Read 1762 times)

jefferymac

  • I’m new here
  • *
  • Posts: 10
  • Karma: 2
Displaying related contacts in a View
November 20, 2009, 09:00:12 am
I'm trying to use Views to display a single Organization contact + a set of contacts that are defined by a relationship type "Location of" the primary Organization.

I'm having trouble understanding how to describe this relationship in Views -- what View type is appropriate, and how to set the Relationship and Filters.

Can anyone provide any pointers?
CiviCRM: 3.02
Drupal: 6.14

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Displaying related contacts in a View
November 20, 2009, 06:04:58 pm
Not sure i understand how your Relationship is working - but for us - a view that displays a page showing all the 'employees' of that company has this recipe

View xxx, displaying items of type CiviCRM Contacts. 

 Filters
CiviCRM Member: Status in New, Current, ...
CiviCRM Contacts: Contact Type = Individual

 Relationships
CiviCRM Relationships: Contact ID B (label = company)

Arguments
CiviCRM Contacts: Contact ID
(uses Relationship = Company, Title = Company Contacts, Validator = Basic Validator)

Now to be honest that doesn't seem to be enough info as I was expecting it to let me specify which Relationship was being required, rather than just which direction. Sorry don't have enough time/brain to backtrack on this, but who knows, the above may set you on the right path. Good luck
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

jefferymac

  • I’m new here
  • *
  • Posts: 10
  • Karma: 2
Re: Displaying related contacts in a View
November 22, 2009, 05:05:15 pm
This put me on the right track.

The issue I was struggling with stemmed from the fact that I was trying to display the primary contact (Central Office) and the associated child contacts (Locations) in the same view. I think this is do-able with attachments, but I find that the views interface gets somewhat confusing when the attachment differs significantly from the default view.

To make a long story short, I solved it using a Panel and two different views, one that pulls the central contact record and one that pulls the associated child location records. My "associated locations" view uses your recipe and modifies the filters slightly:

CiviCRM Contacts: Contact Type = Organization
CiviCRM Address: Location Type = Main (necessary so that it doesn't return both Main and Billing address)

Thanks for the help!
CiviCRM: 3.02
Drupal: 6.14

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Displaying related contacts in a View
November 22, 2009, 05:22:29 pm
well done - yes i don't think i fleshed out that we were using an attached view for the individual contacts and the primary page view for the organisation

attached views is pretty straightforward once you get through the mist.

And it looks like you know to look out for records that can return multiple results eg when they have multiple phone or email fields etc
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Displaying related contacts in a View

This forum was archived on 2017-11-26.