Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: formatting phone numbers Post Reply Post New Topic
Author Message
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Topic: formatting phone numbers
     Posted: 17 Dec 2013 at 5:56am
I have an issue with an export since the phone numbers from the database are all over the place. Meaning some are entered like "(123) 465-7891" while others are like "1234567891" and others are like "123-456-7891".

What I have is a formula to remove everything from the phone number so that it's just straight numbers and then use code to format the field but, it's not working. Here is my formula.

Shared StringVar hPhone = "";
hPhone := Replace(Replace(Replace({Table.homePhone}, "(", ""), ")", ""), "-", "");

hPhone := Picture (CStr (hPhone), "(xxx)xxx-xxxx");

what i want is (123) 456-7891 and what I'm getting is (123) 45-67891. any clue what I'm doing incorrectly?
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 17 Dec 2013 at 6:12am
FIXED. it was a spacing issue. I should have caught that before posting. 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum