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) »
  • sort_name and display_name field mapping
Pages: [1]

Author Topic: sort_name and display_name field mapping  (Read 1938 times)

mtndan

  • Guest
sort_name and display_name field mapping
June 16, 2009, 06:55:04 pm
Hi, I am trying to bulk update a bunch of Households using the Import feature. I need to map the columns:

sort_name
display_name

but it doesn't appear those are available for Household import mappings.

Any suggestions? Is there a config file somewhere that I can add those fields?

Thanks in advance,

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: sort_name and display_name field mapping
June 16, 2009, 07:56:57 pm

both these values are automatically set by CiviCRM. for households, the value for both is the same as household_name

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

mtndan

  • Guest
Re: sort_name and display_name field mapping
June 16, 2009, 08:00:02 pm
Is there a way to modify this behavior?

The client would like Household / Display Name to be in the format usable for mailing labels, like "Bob and Jane Smith".

But, for search results, they would really like the Sort Name to display as "Smith, Bob and Jane"

Thank you

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: sort_name and display_name field mapping
June 16, 2009, 09:02:31 pm

currently no non-hackish way of modifying it :(.

however if you are mysql savvy and have trigger privileges on your mysql db, you can potentially do this as a trigger and stored procedure. i.e. evaluate and change the sort_name after a row has been added / updated

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

mtndan

  • Guest
Re: sort_name and display_name field mapping
June 17, 2009, 04:23:50 am
Ok, so just to clarify, my options are:

1. after import, manually run a sql query on the database to replace "sort_name" values with the values in the "sort_name" column in my import csv file. This would work, but next time I did an import, that column would be overwritten by the household name value

2. hack civicrm. Could you elaborate on how much hackery might be needed and where the code is that copies the household name into "sort_name" on import?

3. write a mysql stored procedure and trigger it after import. This one I don't understand. Can mysql "grab" the value of the sort_name column from the import csv?

Thanks in advance

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: sort_name and display_name field mapping
June 17, 2009, 09:07:06 am

in either case, i think an easier option might be to take the household_name and munge it to be the sort_name as desired by the org via some rules / regular expression. Alternatively you can store this in a custom field and then update the sort name when that custom field is updated

for 2. CRM/Contact/BAO/Contact.php, line 152 (search for "sort_name =")

for 3, the function for the trigger can be a mysql stored procedure that munges the sort_name.

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • sort_name and display_name field mapping

This forum was archived on 2017-11-26.