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) »
  • Searching for Phone numbers
Pages: [1]

Author Topic: Searching for Phone numbers  (Read 714 times)

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Searching for Phone numbers
July 07, 2010, 05:25:35 am
Following up a user enquiry I realised that searches for a contact's phone number aren't as easy as most searches. You can't do it in basic or advanced search so have to do it on a free text search.

Then it appears that a search for "07890 123456" won't find "07890123456" and visa versa.

Is there a search operator to strip out empty space? Users (and admins) aren't consistent with where they put spaces in phone numbers, which depends as much on what breaks in the number make it memorable as anything else.

ctarascio

  • I post frequently
  • ***
  • Posts: 334
  • Karma: 30
    • American Friends Service Committee
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 6.26
  • MySQL version: 5.5.20
  • PHP version: 5.3.13
Re: Searching for Phone numbers
July 07, 2010, 05:54:58 am
Hi EdP,
I know this isn't exactly what you are looking for but perhaps it will help. You can use the "Search Builder" with the operator "Like". For example, Like %078% or Like %07890% will find all the records that contain that string.  You do have to specify a "phone location" e.g. "Primary" and also a "record type" e.g. "Individual", but you have a lot of flexibility with Search Builder so that shouldn't be a problem.

Alternatively, I just realized you can enter %078% in the free text search box and that will accomplish the same thing.

Hope this helps a bit,
Cynthia
« Last Edit: July 07, 2010, 05:58:43 am by ctarascio »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Searching for Phone numbers
July 07, 2010, 03:53:45 pm
I don't think %1234% will find 12 34 in either Search Builder or Full Text Search.

There is a MySQL "replace" function which can be used to replace spaces with nothing:
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace

... so you could use that in a new custom search which just finds contact by phone #, or you could potentially create a new version of the Full Text custom search which does this.

Separately, but possibly related ... in 3.2 you can configure the Quick Search dropdown to include Phone Numbers (Global Settings -> Search Settings). So if I'm looking for Paul Adams, and I have several in my DB, the phone number is right there and could help me distinguish them as well as it's there if i need it.

Protect your investment in CiviCRM by  becoming a Member!

ctarascio

  • I post frequently
  • ***
  • Posts: 334
  • Karma: 30
    • American Friends Service Committee
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 6.26
  • MySQL version: 5.5.20
  • PHP version: 5.3.13
Re: Searching for Phone numbers
July 08, 2010, 05:55:33 am
Right you are Dave. Sorry for the "careless" post  :-[

Hope you are well,
Cynthia

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Searching for Phone numbers

This forum was archived on 2017-11-26.