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 contact data, custom fields checkbox gets overridden rather than added
Pages: [1]

Author Topic: Importing contact data, custom fields checkbox gets overridden rather than added  (Read 8532 times)

iandev

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Importing contact data, custom fields checkbox gets overridden rather than added
June 13, 2013, 05:52:08 am
I have a 4.1.2 version of civicrm running.  I'm importing contact data to update contact information.  I have some custom fields where they are multiple selections (checkboxes).  When I do the import, it removes the old/existing values on that contact and stores the new imported value.  I would like it to behave by adding the new imported value to the already existing values.  Is this possible in this version?  Is there a fix in another version I can take a look at the code to see how it was done?

EDIT: even adding multiple values to the CSV file, it only uses the first value to set for the checkbox type custom field.  Shouldn't it at least add all that are listed in the CSV if I map them correctly?

Appreciate any help.

Ian
« Last Edit: June 13, 2013, 07:32:04 am by iandev »

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: Importing contact data, custom fields checkbox gets overridden rather than added
June 13, 2013, 12:22:39 pm
Hi Ian - you haven't clarified what your import looks like - let's say there is a field called fruit

contact already has banana

you want to add apple, citrus

if you import a cell with apple,citrus it should overwrite banana with apple,citrus

therefore you need to export banana, go through some vlookup rigmarole, concatenate so you end up with apple,citrus,banana

then you should be able to import and end up with all 3 options in the field

messy but afaik only way
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

iandev

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Importing contact data, custom fields checkbox gets overridden rather than added
June 13, 2013, 01:14:05 pm
The import is similar to your example.  Say like you said...contact already has banana.  My csv contains one line for one contact with email and name to associate with correct contact then the custom field will be apple, orange. so imagine this:

John, Doe, jdoe@gmail.com, apple, orange

Then when I import,  I associate the values with the fields.  I set apple and orange to the same custom field.  It will only pick up the first one though.  So banana gets wiped out, orange is ignored and apple becomes the new value. 

So your idea, which I have tried, of exporting the existing values, then combining with the new ones, then finally importing does not work because it only grabs the first value and ignores the rest.

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: Importing contact data, custom fields checkbox gets overridden rather than added
June 13, 2013, 01:21:29 pm
you missed my reference to this needing to be in a single cell
ie the values should be comma separated within a cell

try exporting a record with multiple options if you want to see how it comes out.

hth
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

iandev

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Importing contact data, custom fields checkbox gets overridden rather than added
June 13, 2013, 02:01:59 pm
OK, I got it.  The multiple options need to be comma separated but also surrounded by quotation marks.  While the single fields do not need quotes.  Its the quotes that make the difference.  Thanks. 

But I wonder if they will ever fix it so we don't need to do this roundabout way.

I may be able to implement the fix but I already looked into the code and estimated a huge amount of hours because some things may need to be re-engineered a bit.  I also came up with a hack but that still needs more time to work on it.

Appreciate the help.

Ian

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: Importing contact data, custom fields checkbox gets overridden rather than added
June 13, 2013, 02:21:05 pm
"They" (which is mostly 'us' the community) are more likely to look at that if some code contribution if forthcoming - i suspect it is not trivial - and no one has stepped up yet to fund/work on it. If you can help push it along it would be much appreciated by others who hit this bump
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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Importing contact data, custom fields checkbox gets overridden rather than added

This forum was archived on 2017-11-26.