Crystal Reports: Format string to phone number.

Discussion in 'OT Technology' started by VBGOD, Mar 14, 2005.

  1. VBGOD

    VBGOD Guest

    [​IMG]


    "They" say you have to use the Picture function, which sounds horrible. It doesn't work. :(
     
  2. www.techdo.com

    www.techdo.com New Member

    Joined:
    Mar 5, 2005
    Messages:
    198
    Likes Received:
    0
    Location:
    Europe
    use the totext function.

    If the data in the field for phone # is 0738043311, and you need it to appear like (07) 3804 3311 you can use

    "(" + left(totext({table.field},"#"),2) + ") " + mid(totext({table.field},"#"),3,4) + space(1) + right(totext({table.field},"#"),4)

    Assuming that the phone number is a numeric field.
     
  3. Aaaron16

    Aaaron16 New Member

    Joined:
    Mar 7, 2005
    Messages:
    29
    Likes Received:
    0
    Location:
    Irvine, CA
    I also would use the totext function like above. If you're in the US though, you would probably want a 3 digit area code, so the equation should look something like ...

    "(" + left(totext({Settings.PhoneNumber},"#"),3) + ") " + mid(totext({Settings.PhoneNumber},"#"),4,6) + " " + right(totext{Settings.PhoneNumber},"#",4)
     
  4. VBGOD

    VBGOD Guest

    Jesus, I don't mean to sound like a dick, but I too did a search on google.

    http://www.utteraccess.com/forums/access/access37015.html

    I come to OT for real advice, not googled info.
     
  5. VBGOD

    VBGOD Guest

    Man, I'm a dick. :o Sorry :(

    Thanks for the info.
     
  6. www.techdo.com

    www.techdo.com New Member

    Joined:
    Mar 5, 2005
    Messages:
    198
    Likes Received:
    0
    Location:
    Europe
    No problem.
    Hoping that works fine
     
  7. VBGOD

    VBGOD Guest

    It didn't work, that's why I was angered by your post. :o
     
  8. nukegoat

    nukegoat New Member

    Joined:
    Sep 26, 2003
    Messages:
    23,163
    Likes Received:
    0
    Location:
    San Jose, CA
    I thought converting a phone number was easy... strip out all non-numerics and then put the formatting back in

    I used to do it in cold fusion all the time
     
  9. VBGOD

    VBGOD Guest

    It's very, very easy to do, but..... I need to do this in Crystal reports.
     
  10. Aaaron16

    Aaaron16 New Member

    Joined:
    Mar 7, 2005
    Messages:
    29
    Likes Received:
    0
    Location:
    Irvine, CA
    What's the data type you're using?
     
  11. Firewall97

    Firewall97 Heeeeeeeeeeeeeeeeeeeeee

    Joined:
    Dec 28, 2002
    Messages:
    167,901
    Likes Received:
    117
    Location:
    Iowa
    i dun even understand wtf u are talking about :o
     
  12. Fireal20

    Fireal20 1.125 games away :wtc:

    Joined:
    Oct 22, 2002
    Messages:
    9,257
    Likes Received:
    0
    Location:
    Ft Worth
    VBGOD, please check your PMs
     
  13. VBGOD

    VBGOD Guest

Share This Page