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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Search for contacts with a relationship to a contact with a membership
Pages: [1]

Author Topic: Search for contacts with a relationship to a contact with a membership  (Read 605 times)

ePeterso2

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.30
  • MySQL version: 5
  • PHP version: 5.3
Search for contacts with a relationship to a contact with a membership
January 10, 2011, 07:29:46 pm
(Sorry if this has been asked before ... I did a forum search for some keywords and didn't see a thread about it ...)

Is there some way to do the following search without writing a custom query:

* Show me all contacts at the opposite end of a given relationship to all contacts with given membership(s) in given state(s)

Here's what I've got:

I'm using CiviCRM to manage a children's choir. I've got both my choristers and their parents loaded as individual contacts related by a Child/Parent Of relationship. Choristers have to renew their membership in the choir each year, so I have their participation recorded as a membership. This works well, since if a chorister terminates membership in the middle of a season, I just mark their membership as Canceled. We have four choir levels (by age, roughly), so I created four separate memberships - one per choir.

My problem is this: I would like to create a mailing list group of all choristers that are New or Current members of a particular choir - I know I can do by using an advanced query to create a smart group.

But I also would like to create a mailing list group of all contacts with a Parent Of relationship to a contact who is a New or Current member of a particular choir. I've written a custom query to do this which works just fine, but every time I upgrade I forget to copy over the custom query classes and end up having to retrieve them from my backup.

Question: Is there some way to create a smart group for the parents of my members without writing a custom query? I'm wondering if this is, in fact, possible but that I've overlooked how to do it.

Thanks for any help you can provide.

-eP

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Search for contacts with a relationship to a contact with a membership
January 11, 2011, 06:47:58 am

1. i dont think you can do this via any of the built in search screens

2. where do you put your custom queries? if you use the custom php path and store it outside civicrm root, you dont need to copy it everytime u upgrade. it stays where it is :) I assume u r using custom search?

3. Would be great if you can share your code so others can benefit

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Search for contacts with a relationship to a contact with a membership

This forum was archived on 2017-11-26.