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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Is there a way to search for contacts in ALL of the selected groups?
Pages: [1]

Author Topic: Is there a way to search for contacts in ALL of the selected groups?  (Read 573 times)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Is there a way to search for contacts in ALL of the selected groups?
January 09, 2013, 07:46:31 am
Advanced search (and every other search and report I can find) uses "OR" when selecting multiple groups and searching.  I'd like to search for contacts who are in ALL of the following groups: A, B and C.   Contacts in only group A and C will not be returned.

Can this be done in the GUI?

UPDATE: I've been informed this is not currently possible.  I'm looking for advice, estimates or best practices to implement this search capability within advanced search or a custom search.
« Last Edit: January 09, 2013, 08:38:59 am by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

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: Is there a way to search for contacts in ALL of the selected groups?
January 09, 2013, 11:22:59 am

i was wrong (which was expected and hence asked u to seek peted's advice)

dave remembered that we can use search builder for this search. Slight issue is you have to use group ids rather than a nice select box etc

U can try on drupal.demo using group ids 2 and 4

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

daybell

  • I’m new here
  • *
  • Posts: 21
  • Karma: 0
    • Vermont Progressive Party
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 6.26
  • MySQL version: 5.5.22
Re: Is there a way to search for contacts in ALL of the selected groups?
January 20, 2013, 03:13:15 pm
I ran into this problem recently when trying to do an AND search on two smart groups.  The solution above seems to work if you are looking at two static groups or one static group and one smart group, but not two smart groups.

My recollection is that this has worked in the past when looking at smart groups only...but they say memory is the second thing to go.

Any one else having this problem or having success looking at smart groups only?

Morgan

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: Is there a way to search for contacts in ALL of the selected groups?
January 20, 2013, 03:42:04 pm

Morgan:

can you check on the our sandbox server (sandbox.demo.civicrm.org) and see if this is still an issue there

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

daybell

  • I’m new here
  • *
  • Posts: 21
  • Karma: 0
    • Vermont Progressive Party
  • CiviCRM version: 4.1.5
  • CMS version: Drupal 6.26
  • MySQL version: 5.5.22
Re: Is there a way to search for contacts in ALL of the selected groups?
January 20, 2013, 08:48:53 pm
lobo-

Just confirmed in sandbox (d6).  three static groups exited (ID # 2 3 & 4) and I created two smart groups (ID # 7 criteria is membership in either 2 or 4; ID #8 criteria is membership in either 3 or 4). Groups 2 and 4 have overlapping members.

Search builder acted as expected when looking at either two static groups (2 and 4) or one static group and one smart group (2 and 7) or two static groups and one smart group (2 and 4 and 7).

It returned no results (erroneously) when searching the two smart groups (7 and 8 ), or on the two smart groups and one static group (4 and 7 and 8 ).

Morgan

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: Is there a way to search for contacts in ALL of the selected groups?
January 21, 2013, 02:58:43 pm

any chance you (or your developer / consultant / integrator) can take a look at the code / queries generated and figure out where the bug is

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 »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Is there a way to search for contacts in ALL of the selected groups?

This forum was archived on 2017-11-26.