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 Import (Moderator: Yashodha Chaku) »
  • Importing countries to custom field fails when they have a comma in their name
Pages: [1]

Author Topic: Importing countries to custom field fails when they have a comma in their name  (Read 1324 times)

dotsam

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
  • CiviCRM version: 3.x, 4.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: Various
  • PHP version: Various
Importing countries to custom field fails when they have a comma in their name
October 14, 2012, 08:02:19 am
Hi all,
When importing in to a custom field which is either a 'Select Country' or a 'Multiselect Country' the importer fails on all countries which have a comma in their name like "Iran, Islamic Republic of" and "Korea, Republic of". This happens even when the name is encapsulated by quotes in the csv file. The same country names encapsulated in the same way import without error when imported into the core country field in the contact's address.

I have tried this on 4.2.1 and 4.2.2.
Any ideas how to fix this?
Thanks!
Sam

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: Importing countries to custom field fails when they have a comma in their name
October 14, 2012, 09:03:06 am

Seems like a bug with regard to custom fields and countries

u'll need to investigate the import custom field code and figure out the cause of the bug. If you need help getting started ping us on IRC

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

dotsam

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
  • CiviCRM version: 3.x, 4.x
  • CMS version: Drupal 6.x, 7.x
  • MySQL version: Various
  • PHP version: Various
Re: Importing countries to custom field fails when they have a comma in their name
October 14, 2012, 12:11:03 pm
Thanks for the quick reply -- I've been investigating around the issue for the past couple of hours and haven't had any luck, and I'm probably not going to have time to look in to this much more this week. Here's what I've noticed, which expands somewhat on the original problem:
  • If you import a country into the 'Multiselect Country' custom field, it does not appear in search results (even though the custom field is marked as searchable), but does appear on the contact's page.
  • If you import as a 'Select Country' custom field, the countries come up in searches correctly.
  • If you manually update or add a multiselect country through the 'edit contact' screen, it will appear in searches.
  • I can't see any substantive difference between the entries for an imported country vs an edited country in the mysql table civicrm_value_x_x

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: Importing countries to custom field fails when they have a comma in their name
November 01, 2012, 04:47:20 pm
dotsam: My guess is that the import isn't adding control characters properly.  This is often a hard problem to troubleshoot because many text editors simply hide non-printable control characters.

This sounds vaguely related to my post here: http://forum.civicrm.org/index.php/topic,24477.msg103328.html#msg103328

After writing that post, I think we discovered that a field must begin and end with the SOH control character as well.  So you still need 2 control characters even if you're only importing one value into the multi-select field.

Try comparing the raw data in MySQL from two records:  One that you created manually, and one created via the import.  See if they created control characters correctly.  If not, that might be the bug.

Please post back if you have a chance!

Jon
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Importing countries to custom field fails when they have a comma in their name

This forum was archived on 2017-11-26.