Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: help formatting please Post Reply Post New Topic
Author Message
Betti
Newbie
Newbie
Avatar

Joined: 13 Aug 2007
Location: Canada
Online Status: Offline
Posts: 1
Quote Betti Replybullet Topic: help formatting please
    Posted: 13 Aug 2007 at 11:25am
I have a report that returns long distance numbers dialed.  I would like to be able to insert hyphens within the numbers.

So, instead of the North American calls showing up as 1234567890, I'd like it to show them as 123-456-7890.  Further, if the number starts with 011 (international calls), I'd like it to stay the same, no formatting.


Can anyone help me with this?
IP IP Logged
socrates
Newbie
Newbie
Avatar

Joined: 20 Mar 2007
Online Status: Offline
Posts: 15
Quote socrates Replybullet Posted: 13 Aug 2007 at 8:53pm

use a formula to do this..

write a formula like

if(number starts with 0)

then number

else

add hyphens as required after converting number to string and then using string functions to get the req. no of char.

Hope this helps... Smile

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 14 Aug 2007 at 5:24pm
If this is a text field instead of a number field, you can skip the "after converting number to string" part of socrates response.  The formula for doing this looks something like:
 
left({table.phonenumber}, 3) + "-" + mid({table.phonenumber}, 4, 3) + "-" + right({table.phonenumber}, 4)
 
-Dell
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.