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) »
  • Searching for person being NOT in household
Pages: [1]

Author Topic: Searching for person being NOT in household  (Read 640 times)

behrang

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
  • CiviCRM version: 4.05
  • CMS version: drupal 7
  • MySQL version: 5
  • PHP version: 5
Searching for person being NOT in household
November 19, 2011, 03:47:04 am
Hi
i been playing around with the searches at civicrm and didnt find so maybe i'm blind.
but is there actually anyway to search for person being NOT member of any household?

I'm searching for members of a group and would like to have households and "single"-Non-household person.
Right now I get many duplicates (i.e. the households AND their members) since merging for pdf letter is not available!

so i wondered how i could split the two "problems".

I can get the households being member of a group by search generator.
but how could i get the "single"-Non-household person?
any ideas?
« Last Edit: November 19, 2011, 03:48:48 am by behrang »

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: Searching for person being NOT in household
November 19, 2011, 06:57:04 am

Might be better in the long run in folks spend the extra hours (or euros) and add functionality like "merging for pdf letters" rather than a work-around. Will benefit you and the community

One potential way might be:

1. Tag all individuals with a Tag IND
2. Do a search and find all individuals that belong to a household. For all these individuals, remove the tag IND
3. Do a search with individuals Tag IND. These are your individuals that dont belong to a household

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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Searching for person being NOT in household
November 19, 2011, 08:28:59 am
Hi,

if you can write a custom search, you can so a

Code: [Select]
select ... from civicrm_contacts where not exists (select id from civicrm_relationship where id=contact_id_a & relationship_type = household);

You'll have to investigate the real id for household member and probably deal with contact a and contact b in the table), but select where not exist (select should do it).


X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Searching for person being NOT in household

This forum was archived on 2017-11-26.