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) »
  • Updating contact_sub_type - Not seeing results in search
Pages: [1]

Author Topic: Updating contact_sub_type - Not seeing results in search  (Read 302 times)

mespork

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.5.2
  • CMS version: Drupal 7
  • MySQL version: 14.14
  • PHP version: 5.3.10
Updating contact_sub_type - Not seeing results in search
February 23, 2015, 11:33:30 am
Hello,

We are in the process of cleaning up some of our data. We have a contact subtype that was not supposed to be used and were to move all contacts to a different subtype. Because there we a more than was allowed by profile update we made the change on the civicrm_contact table. This seems to have updated because we are able to see all contacts through when running a query in mysql, however we are not seeing the correct number reflected when searching based in subcontact type (Inquiry)

The only thing that I noticed is the contacts that do show up in the search have the Inquiry (with what looks like boxes with 0001) in the DB dump where one that dont just have Inquiry. Any ideas?

Thanks,

David
« Last Edit: February 23, 2015, 11:35:27 am by mespork »

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Updating contact_sub_type - Not seeing results in search
February 23, 2015, 11:42:18 am
That's the separation character, and that's what's causing your problem.

Take a backup of the database, then insert the separation character before and after your contact subtype data:
Code: [Select]
UPDATE civicrm_contact SET contact_sub_type = CONCAT(UNHEX('01'), contact_sub_type, UNHEX('01') WHERE contact_sub_type IS NOT NULL;

Note that the code above isn't tested on your data, and I don't know what corner cases you might be seeing - but that's the general solution!

cf http://forum.civicrm.org/index.php/topic,24477.msg103328.html#msg103328
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Updating contact_sub_type - Not seeing results in search
February 23, 2015, 11:47:56 am
Maybe safer, substitute 'sub_type_name' with the name of your sub-type:
Code: [Select]
UPDATE civicrm_contact SET contact_sub_type = CONCAT(UNHEX('01'), contact_sub_type, UNHEX('01') WHERE contact_sub_type = 'sub_type_name';
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Updating contact_sub_type - Not seeing results in search

This forum was archived on 2017-11-26.