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) »
  • Advanced search 'AND' operator on tags does not work
Pages: [1] 2

Author Topic: Advanced search 'AND' operator on tags does not work  (Read 3435 times)

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Advanced search 'AND' operator on tags does not work
March 07, 2012, 02:02:51 am
Hi.

Using 4.0.8 when we do an advanced search on several tags using the 'AND' operator, we get an 'OR' result no matter what. I saw in another post that this is normal for groups, is it the case for tags too ?
If not, is there a fix ?
If yes, the documentation should be updated (the floss manual gives a specific example of ANDing tags.)

( On a side note, users can't use tags in the search builder either as one need to know the tag ID for that, something quite technical for end users. )

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: Advanced search 'AND' operator on tags does not work
March 07, 2012, 06:30:52 am

Yes, both tags and groups use the OR operator

If you can edit and update the wiki docs that would be great

If you need to use AND, there is a custom search which you can use

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

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 07, 2012, 06:32:30 am
Quote from: Donald Lobo on March 07, 2012, 06:30:52 am

Yes, both tags and groups use the OR operator

If you can edit and update the wiki docs that would be great

If you need to use AND, there is a custom search which you can use

lobo

Can you elaborate on the custom search , is it documented somewhere ? (looks like I missed it ?)

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: Advanced search 'AND' operator on tags does not work
March 07, 2012, 06:48:29 am

check:

http://drupal.demo.civicrm.org/civicrm/contact/search/custom/list?reset=1

Include / Exclude Contacts in a Group / Tag

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

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 07, 2012, 06:50:45 am
Quote from: Donald Lobo on March 07, 2012, 06:48:29 am

check:

http://drupal.demo.civicrm.org/civicrm/contact/search/custom/list?reset=1

Include / Exclude Contacts in a Group / Tag

lobo

Thanks a lot for the pointer! ;D
i updated the wiki with a link to this.
« Last Edit: March 07, 2012, 06:54:06 am by ehanuise »

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 07, 2012, 07:49:28 am
I looked at the custom search, but there is no option to further filter on the contact type.
I looked at the code to see if it as easy to add, but I can't figure it out, being no coder.

Could anyone help with this ?
The 'Basic' form has a selector for the contact tpe but seems constructed differently from the groups.php one.
I found no way to further refine the search on a results set either.
It's really a pity that this can't be made to work in the advanced search dialog.

The user scenario here is apparently simple : select individuals or organisations matching all selected 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: Advanced search 'AND' operator on tags does not work
March 07, 2012, 08:52:47 am

Document on the custom search framework is here:

http://wiki.civicrm.org/confluence/display/CRMDOC41/Creating+A+Custom+Search+Extension

If your client / org would like to sponsor/develop that feature in advanced search that would be great. I dont think its a trivial project though

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

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 08, 2012, 01:15:38 am
Quote from: Donald Lobo on March 07, 2012, 08:52:47 am

Document on the custom search framework is here:

http://wiki.civicrm.org/confluence/display/CRMDOC41/Creating+A+Custom+Search+Extension

If your client / org would like to sponsor/develop that feature in advanced search that would be great. I dont think its a trivial project though

lobo

It's not the first time I get that reply.
However it's not possible.
I am here internally struggling to get this CRM project going. It's under critic from the users because the interface is complex to use and some functionnalities (like the above) don't work as expected.
One of the 'selling points' for civicrm internally was that it's a non-commercially oriented CRM (it's aimed at communities not at sales management) and that there is a community large enough so that some assistance can be found on the forums.
The only resource available is my time, and there is no way i can get money to pay a developer to work on this.

Once the project gets going in the whole company, it will gain enough traction so that might be possible. But now it's an impediment to its viablity, at best.

So if anyone can help without claiming for a check first, he's welcome  >:(

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 08, 2012, 01:23:36 am
For the record i'm working with a small non-profit that offers administrative help to artists and people with intermittent jobs i the arts and arts-related sector in belgium.
Most of these folks struggle to maintain financial buoyancy, and what we do is help them fill in all the paperworks and legal forms required to legally work as artists or in arts-related sectors (roadies, stage lighters, ...)
We also do lobbying with the government and legal entities to request changes to the legal framework when useful in order to better protect artists and allow them to even exist in the complex legal framework that we live in.

Our use of the CRM is to coordinate the communication with press, lawmakers, and similar entities all over europe to build a network.
It's entierely a non-profit, with currently about 120 workers, and growing.

I woulnd't want to give the impression I'm trying to get a free meal for a commercial client here, it is not the case.


xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Advanced search 'AND' operator on tags does not work
March 08, 2012, 06:39:30 am
Hi,

Great project that you have!

I don't think anyone was thinking anything about a free meal, just that we as well do already quite a few amount of free work, and when it's complex we can't unfortunately take all of them on board and we need to move them to paid project to get a chance of working on them.

Why do you need AND between tags?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 08, 2012, 08:14:58 am
we use tags to differentiate contacts : press, parliament member, lobbyers, ...
One common request is to establish a list of individuals that are for instance both press member and lobbyer.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Advanced search 'AND' operator on tags does not work
March 08, 2012, 08:17:55 am
Ok make sense, and why do you need filtering on contact types (and is this the only criteria you'd need beside the tag or just an example)?

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

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 08, 2012, 08:19:50 am
When we ran the above request trough the custom search on tags and groups, it returns all individuals and organisations (a few hundreds il ann) and there's no way to further sort it to only individuals (to then contact them or print labels)

ehanuise

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 2
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.49-3
  • PHP version: 5.3.3-7+squeeze3
Re: Advanced search 'AND' operator on tags does not work
March 08, 2012, 08:20:21 am
And yes , only criteria so far  ;D

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: Advanced search 'AND' operator on tags does not work
March 08, 2012, 10:35:46 am

1. Create a smart group for all contacts of type Organization

2. Run the custom serch and include all the tags you want included and also include the above smart group. You can make this a smart group also

basically u get the set you want without additional code.

On a side note, you'd be surprised as to the number of folks who do post stating:

a. How surprised they are that such a common scenario has not been handled and solved by someone else so they can use it
b. How shocked they are that something so simple cannot be done and they cannot understand why someone does not do it for them immediately

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] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Advanced search 'AND' operator on tags does not work

This forum was archived on 2017-11-26.