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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Multi Select Field with Many Options - Out of Memory
Pages: [1]

Author Topic: Multi Select Field with Many Options - Out of Memory  (Read 1310 times)

thebenedict

  • Guest
Multi Select Field with Many Options - Out of Memory
March 28, 2008, 08:56:21 am
Hi all,

I want to allow users to enter the countries they are working in -- some have operations in many countries -- so I am trying to make a multi-select custom field containing nearly every country name. I created the field through the UI, but with some help from _dalin on IRC I used the following SQL statements to populate the field with 245 values and labels:

Code: [Select]
INSERT INTO tbl_temp (name, iso_code) SELECT name, iso_code FROM civicrm_country;
INSERT INTO civicrm_option_value (option_group_id, label, value, name, is_active) SELECT 41, name, iso_code, name, 1 FROM tbl_temp;

This almost works, but the countries are not in alphabetical order in the multi-select field even though they are alphabetical in civicrm_option_value. I can't edit the order manually. If I try to view/edit multiple choice options I get an out of memory error:

Fatal error: Out of memory (allocated 32768000) (tried to allocate 1171 bytes) in /homepages/15/d225854661/htdocs/drupal2/sites/all/modules/civicrm/CRM/Utils/Weight.php on line 325

Unfortunately I'm developing in a shared environment and can't get to php.ini. Should 245 country names require this much memory? Any ideas about increasing the memory, or a better approach?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Multi Select Field with Many Options - Out of Memory
March 28, 2008, 10:03:10 am
I'm not sure about the memory issue, but you should be able to solve the alpha order problem by setting civicrm_option_value.weight column to sequential values when you do the insert.
Protect your investment in CiviCRM by  becoming a Member!

thebenedict

  • Guest
Re: Multi Select Field with Many Options - Out of Memory
March 28, 2008, 11:02:38 am
Yep, works great. That will have to do for now. Thanks!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Multi Select Field with Many Options - Out of Memory

This forum was archived on 2017-11-26.