Reformat number to phone number format in Crystal Reports XI

The number is a number in a table.  It shows up like this "8,765,230"   I need it to display like a phone number 234-5789.  I know this is a real no-brainer for most of you, but I have never had to do it, and can't find it anywhere in help menu.  You would think it would be easy to find.

How can I accomplish this?
Becky EdwardsEpic Clarity DeveloperAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
Try this idea

Replace(CStr({YourNumber}/10000,4),'.','-')

mlmcc
0
 
James0628Commented:
Will the number always be 7 digits?  If so, then mlmcc's suggestion is probably about as good as anything else.

 If some numbers will be 7 digits and some will be 10 (with an area code), then:

 If you want the area code to be completely blank (no ()) when there is no area code, you could use something like the following (using mlmcc's suggestion for the 7 digit numbers):

if Length (CStr ({phone}, "#")) = 10 then
  Picture (CStr ({phone}, "#"), "(xxx) xxx-xxxx")
else
  Replace (CStr ({phone} / 10000, 4), '.', '-')


 If you want the area code on the 7 digit numbers to show as "(   )", you could just use:

Picture (CStr ({phone}, "#"), "(xxx) xxx-xxxx")


 James
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.