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) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Boolean search requirement
Pages: [1]

Author Topic: Boolean search requirement  (Read 1694 times)

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Boolean search requirement
October 17, 2009, 04:35:41 pm
I've racked my head trying to work out how to do this, can't find a way, so figured I'd add in a request - if there's a way to already do this, please let me know...
We need to be able to say "Give me all individuals who have a tag like '%sts%' OR who have an activity record where the custom "Secondary Subject" field contains 'STS Outreach'. We then need to create a smart group of the results.

Couple of points:
1. We don't want to use a custom search, as every custom search requires re-jigging when we do a major version upgrade (and, at a minimum, extensive checking when we do a minor version upgrade), due to the DB back end changes
2. Search builder doesn't appear to have a way to include activity records in the search criteria (logically so, as it could get quite complex to gen the SQL)
3. Advanced search defaults to boolean AND

Any way we could get the function that would allow us to tell advanced search what boolean operator to use and the order? So, for example (pseudo-code), " where contact_type = individual AND (tag name like '%sts%' OR activity.secondary_subject = 'STS Outreach')"?

Cheers,
Marty.

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: Boolean search requirement
October 17, 2009, 05:19:50 pm

1. the db schema does not change as often as you think it does :) Most of our custom searches (written in 2.0) have not required any fixing during major/minor fixes

2. If you'd like Advanced Search to support operators as an option, please consider contributing a patch and/or hiring a developer to write the code

All the code is in CRM/Contact/BAO/Query.php

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

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: Boolean search requirement
October 17, 2009, 05:26:26 pm
You could create two smart groups and then assign a parent group. Instead of treating it like an OR, it becomes the union of two queries.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

mlampard

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 3
Re: Boolean search requirement
October 17, 2009, 10:28:00 pm
Thanks for the replies. I think the sub-group union is the way to go.
Cheers,
Marty.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions »
  • Usability Improvements (Moderator: Dave Greenberg) »
  • Boolean search requirement

This forum was archived on 2017-11-26.