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) »
  • Importing Multiple Valued Fields Issue
Pages: [1]

Author Topic: Importing Multiple Valued Fields Issue  (Read 497 times)

britebyte

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 2
  • CiviCRM version: Several 3.4+, 4.1+
  • CMS version: Drupal 6, Drupal7
  • MySQL version: Several 5.1+
  • PHP version: Several 5.2+
Importing Multiple Valued Fields Issue
June 02, 2012, 02:25:51 pm
I have searched everything I could find on this topic. I have looked at: http://forum.civicrm.org/index.php/topic,22146.0.html for example. I have looked in the wiki and found some docs on this topic such as: http://wiki.civicrm.org/confluence/display/CRMDOC33/1.+Upload+Data.
According to this version we can use either the values of the multi-valued field or the labels. I would much rather use the values as they are way shorter than the labels but I have also tried a small test set with the labels - no change. Note: My labels are very long - I hope I am not running into a maximum length issue.

I am using a tab delimited file. If my field FIELD1 can take values aaa, bbb, and ccc I have tried:
ID{tab}FIELD1
1{tab}aaa,bbb
2{tab}aaa
2{tab}bbb,ccc

and I have tried just concatenating with no separator:
(because when I looked in the mysql table "select * from civicrm_value_group1_nn" that is how they are stored)
ID{tab}FIELD1
1{tab}aaabbb
2{tab}aaa
2{tab}bbbccc

Anybody have any suggestions, ideas?

At this point I would be happy to just insert the custom multi-values into the table after importing the contacts. Would it be safe to just enter:

Insert into civicrm_value_group1_nn (entity_id, fieldname_1, fieldname_2)
values (1, aaabbb), (2,aaa), (2,bbbccc);

britebyte

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 2
  • CiviCRM version: Several 3.4+, 4.1+
  • CMS version: Drupal 6, Drupal7
  • MySQL version: Several 5.1+
  • PHP version: Several 5.2+
Re: Importing Multiple Valued Fields Issue
June 02, 2012, 03:05:28 pm
Update: I am pretty sure I have found the spot in the code that handles these multiple values. I think it's in CRM/Import/Parser/Contact.php at lines 1150-1151 which shows that you can use either a pipe or comma to delimit the values and lines 1160-1161 show that you CAN use either the values or the labels. I did use commas with the values shown on the admin "Multiple Choice Options" for this field so I just need to figure out why it is not matching what is returned from CRM_Core_BAO_CustomOption::getCustomOption. Yikes...

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 Multiple Valued Fields Issue
June 02, 2012, 04:16:27 pm
have you done an export of a sample set of data to see how it comes out, as that can often shine light on what the import needs to look like
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

britebyte

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 2
  • CiviCRM version: Several 3.4+, 4.1+
  • CMS version: Drupal 6, Drupal7
  • MySQL version: Several 5.1+
  • PHP version: Several 5.2+
Re: Importing Multiple Valued Fields Issue
June 04, 2012, 05:34:03 am
Hi Pete,

Thanks for taking a look at this issue. Yes, I did export some of the contacts with test values set for this multi-valued field. They came out as the label values for the field. I really don't want to use the label values as they are very long and I will have to redesign one of my intermediate tables in the migration process to use TEXT fields instead of VARCHAR which will move me back a few steps.

According to the code I looked at using the values should be fine so I am still trying to work on that track.

Any thoughts on whether I can just insert the values in the custom value table? I think I will try that today (after making a backup).


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Importing Multiple Valued Fields Issue

This forum was archived on 2017-11-26.