Alpha DevCon 2018
Results 1 to 4 of 4

Thread: fixing format of Phone number field

  1. #1
    Member
    Real Name
    Barry Ehrman
    Join Date
    Dec 2005
    Location
    Broolkyn NY
    Posts
    329

    Default fixing format of Phone number field

    I have a 24 Character Phone field (imported from another application) with the following possible data.

    (123) 456-6890
    ( )123-4567
    ( )123-4567 XXXXXX (etc).
    ( ) - 0
    (123)123-4567 XXXXX (etc.)

    Would like to create 2 new fields:
    1: should just contain numbers
    2: Should contain any alpha characters that might be after the phone number.

    Would like to do this with AS Update operation.
    4th example should be updated to blank.

    Thanks

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,012

    Default Re: fixing format of Phone number field

    1: should just contain numbers
    2: Should contain any alpha characters that might be after the phone number.
    1: should just contain digits

    The expression would be

    Code:
    if(val(remspecial(tst))>0,alltrim(str(val(remspecial(tst)))),"")
    Substitute the original fieldname for tst.
    Last edited by Stan Mathews; 03-26-2009 at 03:31 PM.
    There can be only one.

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,012

    Default Re: fixing format of Phone number field

    2. Should contain any alpha characters that might be after the phone number.


    The expression would be

    Code:
    if(isdigit(right(alltrim(tst),1)),"",word(tst,-1))
    There can be only one.

  4. #4
    Member
    Real Name
    Barry Ehrman
    Join Date
    Dec 2005
    Location
    Broolkyn NY
    Posts
    329

    Default Re: fixing format of Phone number field

    Thanks Stan,
    Worked beautifully

Similar Threads

  1. Phone_dash - format phone numbers.
    By CALocklin in forum Code Archive
    Replies: 4
    Last Post: 06-13-2008, 02:32 AM
  2. Phone Display format
    By Mike Levesque in forum Web Application Server v7
    Replies: 5
    Last Post: 12-13-2006, 12:01 PM
  3. Format Input box for Phone number
    By crimmelcp in forum Web Application Server v7
    Replies: 4
    Last Post: 05-15-2006, 03:47 PM
  4. Clean up messy phone no format function
    By Peter.Greulich in forum Code Archive
    Replies: 7
    Last Post: 02-28-2006, 11:43 PM
  5. phone number mask
    By Richard Mendrala in forum Alpha Five Version 6
    Replies: 3
    Last Post: 04-21-2005, 04:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •