1

I need to find all contacts that are in our system without a tag AND are Individuals AND registered for a specific event.

This is what I am doing:

  • Contact -> Contact Type = Individual
  • Participant -> Event Title = Event Name
  • Contacts -> Tags = Is Empty

Then I error out - the issue is with the tags - even if I choose Is Null - I still get a ton of errors. If I chose Contacts -> Tags -> Not In -> Select every tag. I still get a ton of errors.

PS: Is there a way to use search builder to find an event by Event ID instead of title?

CiviCRM 5.0.2 and Drupal 7

DB Error: No Such Field - Backtrace below.


    #0 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Error.php(190): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
#3 /home/webname/www/www/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
#4 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
#5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", "DB_Error", TRUE)
#6 /home/webname/www/www/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
#7 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
#8 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", "DB_Error", TRUE)
#9 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'civicrm_tag.name' in 'field list'")
#10 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#11 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
#12 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
#13 /home/webname/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1635): DB_DataObject->_query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
#14 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(392): DB_DataObject->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
#15 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(1348): CRM_Core_DAO->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...", TRUE)
#16 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4942): CRM_Core_DAO::executeQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, ...")
#17 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Selector.php(1181): CRM_Contact_BAO_Query->searchQuery(NULL, NULL, NULL, FALSE, FALSE, TRUE)
#18 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(108): CRM_Contact_Selector->alphabetQuery()
#19 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(136): CRM_Utils_PagerAToZ::getDynamicCharacters(Object(CRM_Contact_Selector), FALSE)
#20 /home/webname/www/www/sites/all/modules/civicrm/CRM/Utils/PagerAToZ.php(52): CRM_Utils_PagerAToZ::createLinks(Object(CRM_Contact_Selector), NULL, FALSE)
#21 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Form/Search.php(839): CRM_Utils_PagerAToZ::getAToZBar(Object(CRM_Contact_Selector), NULL)
#22 /home/webname/www/www/sites/all/modules/civicrm/CRM/Contact/Form/Search/Builder.php(414): CRM_Contact_Form_Search->postProcess()
#23 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Form.php(447): CRM_Contact_Form_Search_Builder->postProcess()
#24 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Refresh.php(75): CRM_Core_Form->mainProcess()
#25 /home/webname/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Refresh->perform(Object(CRM_Contact_Form_Search_Builder), "refresh")
#26 /home/webname/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Search_Builder), "refresh")
#27 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("refresh")
#28 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(309): CRM_Core_Controller->run((Array:4), (Array:0))
#29 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
#30 /home/webname/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
#31 /home/webname/www/www/sites/all/modules/civicrm/drupal/civicrm.module(445): CRM_Core_Invoke::invoke((Array:4))
#32 [internal function](): civicrm_invoke("contact", "search", "builder")
#33 /home/webname/www/www/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:3))
#34 /home/webname/www/www/index.php(21): menu_execute_active_handler()
#35 {main}
4

While a code-level fix is obviously preferable, the quick solution is to create two groups:

  • Everyone who attended the event who has the tag.
  • Everyone who attended the event.

Then use the custom search Include/Exclude by Group/Tag to include group 2 and exclude group 1. Who's left is everyone who attended without the tag.

  • Thanks Jon! That worked for me - had to make yet another group so I could display the results to my liking. – themak Apr 27 '18 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.