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) »
  • search results ordered on prefix instead of last name
Pages: [1]

Author Topic: search results ordered on prefix instead of last name  (Read 651 times)

Linda Looise

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.5.4
  • CMS version: Joomla
  • MySQL version: I dont know
  • PHP version: I dont know
search results ordered on prefix instead of last name
January 09, 2015, 09:44:17 pm
Where in the system can I change that my search result will be ordered on 'last name' and not on 'prefix'. If you enter any search criteria, a list of contacts will show up with a top a row: 'A', 'B', 'C', 'D' etc. If I click on 'M' all the contacts with Mr. Mrs. Ms. are shown, even though their last name doesn't start with an M. This make searching for correct contact you are looking for very difficult. Can I somehow change my search result preferences?

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: search results ordered on prefix instead of last name
January 09, 2015, 10:58:38 pm
 Individual Sort Name Format at yoursite/civicrm/admin/setting/preferences/display?reset=1 is the field you are looking for.

You probably want to set it to something like {contact.last_name}{, }{contact.first_name}.

However it isn't quite as simple as changing that setting.  Sort_Name is stored in the contact table and you will have to "do something" to update the sort names already stored there.

Although it doesn't say it will, Coleman thought that perhaps running the  Update Greetings and Addressees  scheduled job would trigger an update of the Display name (and hence presumably the Sort name)  http://forum.civicrm.org/index.php/topic,34965

If it doesn't, what you would need to do would depend on how many contacts you have and what level of coding skills you have.

You also should be aware that if you have disabled "automatic wildcard" yoursite/civicrm/admin/setting/search?reset=1 then changing  Individual Sort Name Format will change how you need to enter names when you do any search based on names ( ie you would need to enter smith, mary).


Linda Looise

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.5.4
  • CMS version: Joomla
  • MySQL version: I dont know
  • PHP version: I dont know
Re: search results ordered on prefix instead of last name
January 10, 2015, 03:15:47 am
Hi Joanne,

This was very helpful. Thank you! I just have seen it before I imported 4000 contact of which 30% has a prefix... I will instruct my staff for the mistake, or think of a way to 'do something' to solve this.

Thanks anyhow!

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: search results ordered on prefix instead of last name
January 10, 2015, 03:21:47 pm
There are various ways that you could fix the existing sort name, but as I said it depends on how many contacts are invovled and whether or not you have any SQL skills.

If you want a purely UI solution you could export the contact Ids, fist name and last name for all the affected individuals, then do an update import of using that file.  That should trigger a rebuild of the Sort name.

If you have hundreds of thousands of contacts that would be a bit tedious and indeed you may have to break the import into several smaller files to stop it choking.

If you have SQL skills you could update the sort name directly in the database.

(You may be able to do it with the API, but, not being a techie, I am not sure about that.  I think it is more for ongoing interactions between applications rather than for a one off thing like this.)
 
« Last Edit: January 10, 2015, 03:28:47 pm by joanne »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • search results ordered on prefix instead of last name

This forum was archived on 2017-11-26.