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 (Moderator: Dave Greenberg) »
  • AND, OR logic
Pages: [1]

Author Topic: AND, OR logic  (Read 2271 times)

madjoe

  • Guest
AND, OR logic
March 27, 2008, 07:57:29 am
Setup:
I've added couple of searchable checkboxes (C1, C2, C3, C4) and their values in a Custom field (CF).

Description:
If I'd like to search for all the results that includes C1 AND C3, the method is pretty simple: I just click on C1 and C3 within my advanced search form. But if I'd like to search for entries that contains C1 OR C3, then my search becomes more difficult: I should manually search for all C1 matches, and then start another search for C3 only.

Issue:
Am I missing something, or this really can not be done with the current CiviCRM setup?

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: AND, OR logic
March 27, 2008, 10:00:50 am

We currently dont support OR searches from the UI.

You can either do two manual searches OR write a custom search form for your specific needs

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

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: AND, OR logic
March 27, 2008, 12:34:02 pm
I thought this was what could easily be done in Search Build- just enter C1 criteria in first box then use "Also include contacts where" and put C3 criteria in that box.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

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: AND, OR logic
March 27, 2008, 12:49:44 pm

argh, thanx for pointing that out, pete :)

yeah, u should be able to do simple AND-OR clauses using the search builder. U'll have to tweak the input for custom fields and experiment a bit 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

madjoe

  • Guest
Re: AND, OR logic
March 28, 2008, 06:46:56 pm
Yes, that SHOULD solve my problem... in fact, I have two serious problems:

1) I tried it by using your online demo and it works, but on my local installation, the Search Builder couldn't find anything from my Custom Fields. I'm using latest clean Drupal 5.7 and CiviCRM 2.0.1 installation (upgraded successfully from 1.9). The search returns 0 results even if I put only 1 simple search criteria within my Search Builder, but the same search from the GUI works perfectly by using Advanced search with the same criteria.

2) There's also a problem with "Could not find valid value for ct" warning message which appears SOMETIMES while adding new Organisations. I couldn't find a pattern to provoke the same warning message. First I thought it's because I'm using a huge set of checkboxes in my Custom Field. I have increased the PHP allowed memory to 128M, but then the same warning message started to appear again in some situations.

What am I missing?

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: AND, OR logic
March 28, 2008, 07:32:26 pm

1. your best bet would be to enable mysql query logging and see what query is generated for the search builder. this might help you and us figure out whats happening. You should also compare the query generated with what advanced search generates. What version of PHP are u running?

2. if you can reproduce the scenario that causes this it would be really helpful. We'd like ssh access to the box and a way to reproduce the issue on a consistent basis. Most likely it has something to do with the session getting corrupted due to some "unknown" reasons

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) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • AND, OR logic

This forum was archived on 2017-11-26.