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 (Moderator: Dave Greenberg) »
  • Search ANDing and Tags
Pages: [1]

Author Topic: Search ANDing and Tags  (Read 2566 times)

g3prime

  • I’m new here
  • *
  • Posts: 7
  • Karma: 0
Search ANDing and Tags
January 15, 2009, 06:11:00 pm
From the help in the Advanced Search page it states the following: "If multiple boxes are checked for Contact Types, Groups, Tags and Location Types, the selections are combined as OR criteria"

In the Search Builder two statements can be created with different Tag(s)ID numbers but the search results in records with either TagID_A or TagID_B

Is there any way to build a search that ANDs Tags?

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 ANDing and Tags
January 15, 2009, 07:18:49 pm

You will need to write a custom search for this. This is not possible via the UI currently (IMO)

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: Search ANDing and Tags
January 16, 2009, 12:01:04 am
Hi,

It'd be a nice option to switch between or and and.

This being said, might be way easier to to that with solr.

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

g3prime

  • I’m new here
  • *
  • Posts: 7
  • Karma: 0
Re: Search ANDing and Tags
January 16, 2009, 10:31:50 pm
Lobo and Xavier,

Thanks for the responses. Will try to build a custom search.

fbi365

  • Guest
Re: Search ANDing and Tags
February 11, 2009, 11:39:27 am
I'd like to stay in the loop on this.  Has anything come of this yet?  I would like to be able to limit my searches, not expand them by using tags.  This would require an "and" function.  Also, advanced search page is screwed up.  No search button, and right half of screen is cut off.  Not sure if this is the place for that but there it is.     

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Search ANDing and Tags
February 11, 2009, 01:01:12 pm
agreed that switching would be a nice option. if not in advanced then it seems it would be a simple addition to search builder, no?

i looked through some issues and found this one which is slightly similar but seems more detailed and thus put to 3.0...
http://issues.civicrm.org/jira/browse/CRM-548

is there anything else in the pipe? should this one feature be filed separately than above issue?

fbl365 -- your advanced search page view issue should be posted as another topic. it is likely a problem with your drupal/joomla view rather than civicrm.

g3prime

  • I’m new here
  • *
  • Posts: 7
  • Karma: 0
Re: Search ANDing and Tags
February 13, 2009, 12:42:43 am
Lobo and Xavier,

Back at it again. So I checked the documentation regarding custom searches (http://wiki.civicrm.org/confluence/display/CRMDOC/Custom+Search+Components) but can't seem to get off the ground. I replied in this thread as it pertains to the elusive AND function. I'm trying to follow the example posted but can't find ContributionAggregate.php to create EmployerListing.php.

Basically trying to put the following fields together for the custom search page:

NAME FIELD pulls from:
-------------
civicrm_contact-first_name
civicrm_contact-last_name
civicrm_contact-organization_name
civicrm_domain-email_address

custom fields
  RMGroup Client1-4FName
  RMGroup Client1-4LName
  RMIndivid Client1-4FName
  RMIndivid Client1-4LName

TAGS section with AND/OR selection capability
----------------
  civicrm_tag-name (multi-select, in 4 columns)

NOTES
-------
notes

I will gladly post this elsewhere (new or existing thread) if needed. I guess I'm just looking for some additional documentation on how to create custom searches. Any links, etc. would be appreciated. Thanks.


emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Search ANDing and Tags
February 13, 2009, 05:39:47 am
g3prime

the first thing you need to do is just write the proper mySQL query. to start you can ignore all the code formatting; just get a query together that if you run it directly on the db via shell or phpmyadmin returns the results you want. you can look at the other example pages for searches to help pull the formatting of the query together. 

after you have  working query, then follow the wiki page and make a new custom search from an existing one.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Search ANDing and Tags
February 13, 2009, 11:57:48 am
The existing custom searches (including ContributionAggregate.php) are all in this folder (in svn, and same in your install):

http://svn.civicrm.org/civicrm/branches/v2.2/CRM/Contact/Form/Search/Custom/
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Search ANDing and Tags

This forum was archived on 2017-11-26.