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 (Moderator: Dave Greenberg) »
  • How Multiselect items are stored
Pages: [1]

Author Topic: How Multiselect items are stored  (Read 2555 times)

mcsmom

  • I post frequently
  • ***
  • Posts: 266
  • Karma: 23
    • Official Joomla! Book
  • CiviCRM version: 4 and 3.4
  • CMS version: Joomla!
How Multiselect items are stored
September 19, 2007, 06:11:23 am
I have to pull in a multiselect field. I am doing it in mysql, partly because of the issue I am mentioning below.

Multiselect fields are stored with a separator, which is a special character (it is hex).  This is the question I got from the person helping me:
 
Quote
   I did find that the value is stored in the CIVICRM code at
...civicrm/CRM/Core/BAO/CustomOption.php
 
   Right at the top is a define statement.
 
define( 'CRM_CORE_BAO_CUSTOMOPTION_VALUE_SEPERATOR'," ");
 
   Possibly we could set this as | instead?
 

Would there be any negative impact if I made that change? Actually, I believe if I could do that I could even use the civicrm import function. :)

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: How Multiselect items are stored
September 19, 2007, 11:46:31 am

You can change that and use '|'. However ensure that you do not use a '|' in any of your custom option values.

You will also need to reapply the change when you upgrade

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

mcsmom

  • I post frequently
  • ***
  • Posts: 266
  • Karma: 23
    • Official Joomla! Book
  • CiviCRM version: 4 and 3.4
  • CMS version: Joomla!
Re: How Multiselect items are stored
September 19, 2007, 12:06:09 pm
Happy dance here.

mcsmom

  • I post frequently
  • ***
  • Posts: 266
  • Karma: 23
    • Official Joomla! Book
  • CiviCRM version: 4 and 3.4
  • CMS version: Joomla!
Re: How Multiselect items are stored
September 20, 2007, 07:47:36 am
Less happy now. It seems as though this character must be used in more than one place, because it showed up again.
So, it definitely is more complicated than above.

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: How Multiselect items are stored
September 20, 2007, 11:24:19 am

Not sure what you mean by "showed up again", but there are at least a couple of steps you need to do:

1. make a copy of your current db

2. convert ALL your current custom values (and other places where the separator is used) to use the new separator. (you can probably find all the places its used by doing a search on the code base. So this will involve a series of update statements on the db

3. switch the separator value in the code and do some QA

The code will not function properly if there is the old separator in the db and a new one in the code.

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

mcsmom

  • I post frequently
  • ***
  • Posts: 266
  • Karma: 23
    • Official Joomla! Book
  • CiviCRM version: 4 and 3.4
  • CMS version: Joomla!
Re: How Multiselect items are stored
September 20, 2007, 06:55:41 pm
Yeah, basically what I did was to great a whole new field. However, what seemed to happen was that when I went to edit an entry, it would go back to using the old delimiter. I have to investigate further.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • How Multiselect items are stored

This forum was archived on 2017-11-26.